Overclock.net › How To's › Howto Moving Your Existing Nix Install To A New Pc Or Drive Using Gparted

Howto Moving Your Existing Nix Install To A New Pc Or Drive Using Gparted

This is a guide on one of the easiest ways of moving one *nix install to one disk from another, or, if you can move one of the disks, from computer to computer.

1. Connect both drives to ONE computer. Then boot off a live disk/usb with a live OS compatible with the filesystems on your current install(s). If you have a mixed *BSD/Solaris and Linux system, you may have to use two live OSes for either one, I would say PC-BSD for UFS/UFS2 and ZFS, any Linux live disk for Ext{1,2,3,4}/BtrFS/XFS/etc.

2. Install (if not already there) GParted on the live OS and launch it.

3. On the old disk, copy a partition. as shown:

4. Then use the menu in the top right to change disks to your new disks. Paste the partition there, by right clicking on the empty drive.

5. Repeat 4. until all partitions are copied. you can ignore copying efisys and bios_boot partitions if you use GPT, but remember to create a new one on the new disk if you plan on being able to boot from it. For for organization sake I suggest doing this from beginning onwards.

6. Now, all of your data is over, but grub hasn't been installed to the MBR/efisys/bios_boot. so, chroot time. NOTE= these next steps can also be used to recover an over written grub bootloader , minis the fstab step.

first you will need to mount all of your partitions, again not including efisys/biosboot. Become root and then start with /
su - 
mount /dev/sdXx /mnt

replace the Xx with the number of the disk and the number of the partition. both of these should be listed in GParted.

Then, mount any other partitions
mount /dev/sdXx /mnt/{home, boot, etc.}

after this change to that directory
cd /mnt

then run these commands, one line at a time.
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/

Now to move back into your install,
chroot . /bin/bash

7. Update your fstab.
*in the chroot*
nano /etc/fstab

now, in a different terminal of the live OS run this:
ls -lF /dev/disk/by-uuid/

now, write the UUIDs of the new disks partitions into your fstab inside the chroot. alternately, you could run nano /mnt/etc/fstab and edit them from there, both should work. make sure to use the correct partition UUIDs for the right mount points, it's quite impossible to mount your home partition as root.

8. Now inside the chroot do the actual installing of grub.
grub-install /dev/sdX

again, replace X with the drive number. HOWEVER, I highly suggest not putting a partition number as this requires a different way of booting that is harder to setup and not recommended, called blocklisting.

now, last step:

9. reboot, make sure bios is pointed at the right drive and enjoy!

POSSIBLE PROBLEMS: The only one I ran into was that everything in /home was owned by root, a simple change running any file manager as root. Also, in some OSes grub is called on by grub2, so update-grub would be update-grub2 etc. ran into that with F17. If anyone notices any problems with this please post.

Comments (3)

When I set up my system I put the root drive "/" on one drive (my ssd) then I put /home on a larger hdd. If anything happens, or a teansfer is needed, I can remount the home drive on a new system. Just make sure you do not reformat the /home drive!
sure, but that doesn't save programs and other stuff. I spend a lot of time getting it how I want it, so this is better.
Would saving the boot sector with the dd command be an effective way of transferring the grub install? What if any advantages are there in update-grub versus saving boot sector of the old and writing it on to the new drive?
Overclock.net › How To's › Howto Moving Your Existing Nix Install To A New Pc Or Drive Using Gparted