Posts tagged: restore

Resizing Your File System: There’s A Pill For That

It eventually happens that I find that my file system was inadequately setup or the size of my data was grew larger than original design plans. Whatever the case may be, the problem is simple… The file system is too small. There are two approaches to this. You can make a file copy backup of your data, which I’ve shown you in a previous post, and restore the data on to a new hard drive.

In one sentence I’ve explained my first post here, but let me elaborate some important parts.

  1. You need to partition your new drive to fit your new needs and don’t forget to make your boot partition active or your bios will most likely not run your boot loader.
  2. You need to format the new partitions.
  3. At this point you can copy back your data.
  4. You will need to setup your master boot record/boot loader to load your files you’ve just restored.
  5. You may need to alter your /etc/fstab if you’ve changed the partition numbers around.

If anyone finds a want for me to cover partitioning and or formatting partitions before I end up writing a post about it, feel free to leave a comment.

To restore your files you simply reverse the command from my previous post. The only catch is that you will start by mounting your root partition first. Then restore your root files. Then repeat by mounting your next file system on the new root and then restoring its files. Here is an example.

~ # mount /dev/sdb3 /mnt/newroot
~ # rsync -avHSx –numeric-ids –progress /mnt/backups/root/ /mnt/newroot
~ # mount /dev/sdb1 /mnt/newroot/boot
~ # rsync -avHSx –numeric-ids –progress /mnt/backups/boot/ /mnt/newroot/boot

The quickest way to reinstall grub is knowing a few things about your setup. Here is an example based on my system.

~ # grub
grub> device (hd0) /dev/sda

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0×83

grub> setup (hd0,0)

Basically the jest of what that command does is; after entering the grub shell, you set the first drive to /dev/sda, then we say that the root of Grub will be in the first drive’s first partition. The last command installs grub on to your drive.