msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

15 Jul 2015 Virtualize physical Ubuntu linux server

This post describes how to create a bit for bit copy of a Ubuntu 14.04 LTS server using tools like gddrescue and qemu from a Ubuntu Live-CD. This procedure can actually be used to create a copy of any operating system, not just Ubuntu.

This could probably have been done more easily and faster using VMware vCenter Converter Standalone Client but I have experienced that not all linux flavours can be converted easily.

To perform such an operation you need several things.

  • Extra harddrive – same size or bigger than used disk space
  • Access to the linux packages gddrescue, qemu-imgThe first thing you should do to reduce the time ddrescue uses to copy the data is to remove unneeded files and folders as well as removing harddrives that you do not want to copy.

Creating the disk image

# ddrescue --nosplit /dev/sda imagefile.img imagefile.log

The –nosplit option copies the disk without retrying or splitting the file and is also “fast”.
Remember to place the imagefile.img on another harddisk than you are imageing to avoid filling your disk.

Convert the img file to a VWware VMDK disk file

# qemu-img -p convert -f raw sda.img -O vmdk sda.vmdk

Options used
-p gives you a nice progress indication of the conversion
-f raw tells us that we a trying to convert a raw disk image
-O vmdk describes the output format of the new disk image, in this example a VMware VMDK-file

qemu-img (1.5.0) supports a wide range of formats like vvfat vpc vmdk vhdx vdi sheepdog sheepdog sheepdog rbd raw host_cdrom host_floppy host_device file qed qcow2 qcow parallels nbd nbd nbd dmg tftp ftps ftp https http cow cloop bochs blkverify blkdebug.

Tags: , , , , , ,

Posted by

08 Oct 2014 Set og change default “Open With” application in Ubuntu

This post describes how to associate a file ending like PAR2-files with the pypar2 application in Ubuntu Unity.
You can also use the mimeopen command to change associated file type to other applications.

$ mimeopen -d unknown-file.par2
Please choose a default application for files of type application/x-par2

	1) Other...

use application #1
use command: /usr/bin/pypar2
Opening "unknown-file.par2" with usr  (application/x-par2)

pypar2 will now open the files automatically when you open it using Nautilus filemanager.

This has been tested on Ubuntu 13.10 and 14.04.

Tags: , , , ,

Posted by

19 Nov 2013 Installing build-essentials in CentOS or Ubuntu

This post desrcibes how to install “build-essentials” on CentOS/RedHat og Ubuntu/Debian. build-essentials provides the packages you need to build or compile source code (make and gcc) and create binary files. The build-essentials package is a quick way to install the packages needed to compile VMware Tools on a VMware guest.

In Ubuntu

$ sudo aptitude install build-essentials

In CentOS

# yum groupinstall "Development Tools"

You might also need kernel sources to compile some software

# yum install kernel-devel kernel-headers

Tags: , , ,

Posted by

09 Jul 2013 Add new harddisk to linux without reboot

This is a short post on how you can add a new SATA og SCSI harddisk in your running/live linux machine without a reboot.
The BIOS of the machine is not aware of new hardware being added, but you can ask the disk controllers to rescan and become aware of new harddisks.

This is how you force a rescan of the SCSI controller in your linux machine
$ sudo echo "- - -" > /sys/class/scsi_host/host3/scan
I used host3 because the disk was connected to that controller, but you should replace it with the controller you use.

To see the result of the rescan you can issue the dmesg command
$ sudo dmesg
[ 3117.041231] ata3: hard resetting link
[ 3117.371445] ata3: SATA link down (SStatus 0 SControl 300)
[ 3117.371464] ata3: EH complete
[ 3128.224802] ata4: exception Emask 0x10 SAct 0x0 SErr 0x4050000 action 0xf
[ 3128.224809] ata4: SError: { PHYRdyChg CommWake DevExch }
[ 3128.224818] ata4: hard resetting link
[ 3129.100450] ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 3129.108545] ata4.00: ATA-8: ST31500341AS, HP23, max UDMA/100
[ 3129.108550] ata4.00: 2930277168 sectors, multi 0: LBA48 NCQ (depth 0/32)
[ 3129.140500] ata4.00: configured for UDMA/100
[ 3129.151034] ata4: EH complete
[ 3129.151159] scsi 3:0:0:0: Direct-Access ATA ST31500341AS HP23 PQ: 0 ANSI: 5
[ 3129.151491] sd 3:0:0:0: Attached scsi generic sg1 type 0
[ 3129.151568] sd 3:0:0:0: [sdb] 2930277168 512-byte logical blocks: (1.50 TB/1.36 TiB)
[ 3129.151895] sd 3:0:0:0: [sdb] Write Protect is off
[ 3129.151900] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[ 3129.152052] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 3129.176718] sdb: sdb1
[ 3129.178535] sd 3:0:0:0: [sdb] Attached SCSI disk
[ 3571.306535] ata4: hard resetting link
[ 3571.781238] ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 3571.821270] ata4.00: configured for UDMA/100
[ 3571.831850] ata4: EH complete
[ 3756.103000] ata4: hard resetting link
[ 3756.574619] ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 3756.614674] ata4.00: configured for UDMA/100
[ 3756.625209] ata4: EH complete

This example has been tested on Ubuntu 12.04, but should work on any other linux flavour available.
This post was highly inspired by http://www.cyberciti.biz/tips/vmware-add-a-new-hard-disk-without-rebooting-guest.html that also describes how you remove devices etc withour reboot. This is a great way to add new harddisk to a virtualized linux server that cannot be rebooted.

Tags: , , , ,

Posted by

26 May 2013 Remux MTS (AVCHD) files to MKV using mkvmerge in linux

This post came to life because I did not manager to get my newly aquired Raspberry Pi 512MB version revision 2 running raspbmc to play my MTS files without freeze/rebuffering. One solution was to overclock the Arm processor to 1000MHz, but then I struggled to find a way to get the CPU temperature down. The other solution was to convert or remux the MTS file to Matroska format using a Ubuntu linux server using the mkvmerge command.

From a console window install the required package to perform the remux operation
$ sudo apt-get install mkvtoolnix

Then I did a quick test to remux the MTS file to MKV
$ mkvmerge -o OutputFile.MKV InputFile.MTS
mkvmerge v6.1.0 ('Old Devil') built on Mar 4 2013 20:24:55
'InputFile.MTS': Using the demultiplexer for the format 'MPEG transport stream'.
'InputFile.MTS' track 0: Using the output module for the format 'AVC/h.264'.
'InputFile.MTS' track 1: Using the output module for the format 'AC3'.
'InputFile.MTS' track 2: Using the output module for the format 'PGS'.
The file 'OutputFile.MKV' has been opened for writing.
'InputFile.MTS' track 0: Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 1920/1080.
Progress: 100%
The cue entries (the index) are being written...
Muxing took 19 seconds.

This example remuxed a 339MB MTS file to Matroska in 19 seconds and is a quick and easy fix to perform on my video collection.
Muxing a 1.3GB MTS file took 2 minutes 9 seconds. The resulting MKV file is a little bit smaller than the original MTS file.

I have not experienced any playback problems using raspbmc connected to my Sony Bravidia KDL-40EX711 LED TV even though some people complain that older devices cannot play files remuxed using newer version of mkvmerge because of “Header compression” is enabled by default, ref http://www.mediasmartserver.net/2010/08/09/mkv-mania-header-compression-and-the-side-effects/.

Playback of the MKV file is now without any freeze or rebuffering and the Raspberry Pi is now working as a power efficient media PC directly connected to my TV using a HDMI cable and using a external power suppply.

Playback has been tested on Raspbmc running XBMC 12.2 Git:20130502-32b1a5e using “System Performace Profile – Normal” without any advanced overclocking options enabled.

As a note .MTS files are AVCHD coded and can also end with the .M2TS file suffix.

Tags: , , , , , , , , , , ,

Posted by