Migrating a Linux machine

In my case I needed to move a machine from a headless box to an ESXi server.  The VMWare tool does not support software raid.

I started by installing the OS on the new box with the same partition layout.  This takes care of all of the mbr and boot stuff.  The critical part, though, is / with the configuration, installed programs and any amount of data.  I used nc to do this and did it very painlessly.

#server you’re sending files to
nc -l 1024 > backup4.tgz

#client you’re backing up
tar -cvpz –one-file-system / | nc neon.imaginenetworksllc.com 1024

#boot the new box aka new client with a linux live cd and mount the partition
mkdir /mnt/sda3
mount /dev/sda3 /mnt/sda3
nc -l 1024 | tar -xvpzf – -C /mnt/sda3

#on that backup server
cat backup4.tgz | nc NEW.BOX.COM 1024

In my case I just installed the OS on the box so it had grub and the boot partition all done. What makes this box is the files in /.
Moving from ext3 partitions on md0 devices directly to sda1 I have to tell it to mount correctly.
*/etc/fstab
*eth0.bak has the ip config

*nload was nice to monitor network usage

*lots of help from https://help.ubuntu.com/community/BackupYourSystem/TAR

Visualizing disk usage in Linux – CLI/command line

http://gt5.sourceforge.net/

This project is simply amazing.  The download includes the binary and other files.  Simply execute gt5 from where it is extracted or more wisely place it in /bin/gt5 so you can run it from anywhere.  You can specify any directory (ie: gt5 /).

*stores previously ran information and will show you the different (in bytes)
*very nice easy interface
*largest (percentage) at the top to narrow down where the disk usage is
*runs on nearly any system with included utilities (du for example)

Output is done in HTML and easily shown after parsing with the included tool, again with the simple execution of gt5 /

It took a bit of digging to find a good program that would work directly in the shell for headless machines.  This one is simply fantastic.

 

EDIT:
gt5 is still pretty good but it’s not as easy/fast to get installed.  Recently I’ve been using ncdu thanks to this question/answer.  There are CentOS and Debian packages in their repos.  ncdu homepage.