Moving ubuntu partition

Alan McKinnon alan at linuxholdings.co.za
Sat Jun 10 23:20:41 UTC 2006


On Sunday 11 June 2006 00:13, Yorvik wrote:
> We have just added a second HD to our machine and want to move
> ubuntu from the first drive to the second, whats the best way of
> doing this. The first drive is split 50:50 windows/ubuntu and we
> want to end up with windows on the first drive and ubuntu on the
> second.

All you need do is copy the Ubuntu files from hda to hdb, preserving 
the same partition structure. Then edit the relevant entries in your 
boot loader config file and /etc/fstab and any other config files 
that know about partitions (often the first two is enough).

The long way round is to use fdisk to create the new partitions, and 
cp -a to copy everything across. The faster way (assuming that none 
of the new partitions are smaller than the corresponding ones on the 
first drive) is dd:

dd if=/path/to/old/partition of=/path/to/new/partition bs=[blocksize]

Eg, to copy the old home on /dev/hda6 to the new location /dev/hdb3 
using a block size of 1k:

dd if=/dev/hda6 of=/dev/hdb3 bs=1k

Once this is done, reboot and check that ubuntu works ok in the new 
location. Now you can delete the old partitions on hda with fdisk and 
resize the Windows NTFS partition to the full disk. It's highly 
likely that partition starts at the beginning of the disk, ntfsresize 
will do this nicely.


-- 
If only me, you and dead people understand hex, 
how many people understand hex?

Alan McKinnon
alan at linuxholdings dot co dot za
+27 82, double three seven, one nine three five




More information about the ubuntu-users mailing list