D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Copying partitions to new (larger) HDD

 

Simon Williams wrote:
> Hello.
> I've just bought a 500Gb SATA drive (/dev/sda) for my PC. The old drive 
> is a 120Gb IDE drive (/dev/sdb).
> 
> The old drive is destined for other uses, so I need to copy all the 
> partitions to the new drive and run my system from there.
> 
> However, I'm not quite sure how to go about this. If I was to do dd 
> if=/dev/sdb of=/dev/sda, what will happen to the extra space on the end 
> of the disk? And will the partition table be OK or will that not work?
> 
> The other question is, if I was to create partitions in advance on the 
> new disk and copy individual partitions like this:
> dd if=/dev/sdb1 of=/dev/sda1
> would that work, provided the destination partition is larger than the 
> old one? Or do I have to do something afterwards to make it use all the 
> space?
> 
> Any ideas?
> 
> Thanks in advance.
> Simon
> 

I'd boot off a Live CD (Knoppix, Ubuntu etc) and then partition your new 
drive how you want it.  Then mount the old partitions and the new 
partitions and copy everything over as Neil suggested.

You'd also have to install a boot loader (Grub for instance) which might 
be just a case of running grub-install hd0 and updating your fstab (if 
it uses UID's or volume labels instead of just plain hold /dev/sda1, 2, 
3 etc...).

Make sure you copy and not move too, that way if things screw up you can 
go back to the smaller drive (and just a thought, is the plain old IDE 
drive /dev/sdb or /dev/hdb?)

Rob


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html