There are multiple valid ways of backing up a Linux system. I’m going to only talk about one method here, however. Using Symantec Ghost2003 you can image the system disk partitions and save them away for a rainy day. Given that Ghost will image the whole partition, it makes sense to make the root partition as small as possible so that backups can occur within reasonable time. One of my pet peeves is that pre-configured computers or rather mis-configured computers have one large gigantic partition with everyone on it. This is a maintenance nightmare. The system may only take up 4G of space, but some user has 200G worth of files sitting there. When you image the disk, you end up copying that extra 200G of deadweight. You may ask, “well don’t you have to backup that 200G anyway?” Yes, but there’s a better way than using Ghost for this.
The whole purpose for using Ghost is that in total disk failure, you can just pop in a new disk, create some partitions, and then restore the whole system, as it was configured with minimal effort and knowledge of how it was set up. You can’t just command line copy all the files from root to another directory and expect it to boot the same way. Ghost preserves special files like devices, which you just can’t copy normally.
However, personal data files are just regular files, and so incremental backups using rsync is my preferred method.
So lets get started. Step 1 is to pare down the system files. If you’re lucky, /home is mounted separately. If not, I would resize the root partition to 50G or less and then create a new partition with the freed up space and mount it as /home
WARNING: mucking with the file system can be dangerous as you could wipe out whole partitions with a single stroke. (unfortunately, the ‘q’ quit with no changes is right next to ‘w’ write changes in fdisk, so watch out!)
Resizing the system partition.
Get a bootable CD of a Linux Rescue CD like Fedora7
Boot to rescue. Skip the step that asks if you want to mount any found Linux systems. You now get dropped to a shell. Check the disk you are going to resize with e2fsck. Use df to see what devices and sizes you have.
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda2 50397 21110 27751 44% /
/dev/sda1 99 36 59 38% /boot
/dev/sda2 is about 50G. If I wanted to resize it to 30G I would use
resize2fs -p /dev/sda2 30G
(now go get some coffee.. the -p (progress) is important so you can see that its doing something and about how long it will take, else you might think its hanging)
After the filesystem is resized, you must then shrink the size of the partition upon which it resides using fdisk. In our example you would run
fdisk /dev/sda
Note the starting block number of the partition. Delete the partition and create a new, smaller partition with the same starting block number. If you don’t use the same starting block number, it will probably trash the file system. Make certain the new partition is big enough to hold the resized file system and +10% for overhead.
Now you can create a new partition with the freed up space.