How do I clone a drive and resize (downsize) a partition ? fdisk verify warning.

Linuxguy123 linuxguy123 at gmail.com
Fri Jun 25 00:57:20 UTC 2010


On Thu, 2010-06-24 at 17:10 -0700, JD wrote:

> If you dd partition A on drive 1  to partition B from drive 2, and the 
> size of partition B is
> LARGER that partition A, then the size of the FILESYSTEM on partition B 
> will be identical to size of partition A. In other words, the filesystem 
> superblock will retain the info about the size that it occupied on 
> partition A - and thus you will  not be able to take advantage of the 
> full size of partition B.
> If B is bigger than A, then you need to do something different:
> Boot any Linux System Rescue CD, and DO NOT ALLOW IT TO MOUNT ANY LINUX 
> SYSTEM IT FINDS.
> That is important.
> After you have fdisk'ed your partitions on the new drive,
> and mkfs'ed the correct filesystems on those partitions:
> 1. mkdir -p /disk1/part1 /disk1/part2 ...etc
> 2. mount these partitions. i.e.
>     mount /dev/sda1 /disk1/part1; mount /dev/sda2 /disk1/part2
> 3. mkdir -p /disk2/part1 /disk2/part2 ....etc
> 4. mount these partitions. i.e.
>     mount /dev/sdb1 /disk2/part1; mount /dev/sdb2 /disk2/part2
> 5. cd /disk1/part1
> 6. tar cf - . | tar -C /disk2/part1 -xpf -
> 
> similarly repeat steps 5 and 6 for part2, part3, ...etc; i.e.
> cd /disk1/part2
> tar cf - . | tar -C /disk2/part2
> 
> As far as swap partitions (I asume you created them on disk 2:
> mkswap /dev/sdbX where X is the number of the swap partition.
> 
> Good luck

Or you could just use gparted !




More information about the users mailing list