[plug] dd </dev/hda >/dev/hdb

Peter F Bradshaw pfb at users.sourceforge.net
Sat Dec 2 12:19:03 WST 2000


On Fri, 1 Dec 2000, Thomas, Andre wrote:

> Hi,
> 
> I was planning changing a hdd from a 2gig to a 6gig using the command:
> 
>      dd </dev/hda >/dev/hdb
> 
> However, it has just been suggested by a collegue that this may only
> make 2gig accessable on the 6gig drive.  Is this correct?  If so, would
> there be a better way?

Hi Andre;

Your collegue is correct. the dd function works at the raw section or, in this
case, the raw divice level so the file system structure (including super
blocks etc) will be copied from the 2gig to the 6gig as is. In general dd
only works for disk sections having exactly the same size in blocks.

The method I is to section the target disk, using fdisk, and then mount it on
the source drive and use tar to copy the necessary sections from the source to 
the destination.
For example assume you have the root section on /dev/hda2 and /boot on
/dev/hda1:

find /proc > /no_copy
mount /dev/hdb2 /mnt/hdb
mount /dev/hdb1 /mnt/hdb/boot
(cd /; tar -cvpf - --exclude-from /no_copy .) | (cd /mnt/hdb; tar -xpf -)

If you have been booting from the 2gig and wish to boot from the 6gig then
you will need to put the initial loader on it. The above will have placed
a reasonable lilo.conf, from the source drive, in /mnt/hdb/etc. You may, or 
may not wish to change this. Then run lilo on the 6gig by:

lilo -t -r /mnt/hdb         # Only testing
lilo -r /mnt/hdb            # For real.

Cheers

--
Peter F Bradshaw          | http://members.dingoblue.net.au/~pfb
pfb at users.sourceforge.net | PGP public key at
http://www.pfb.tsx.org    | http://members.dingoblue.net.au/~pfb/public_key.html
ICQ 75431157 (exadios)    | "Needs more salt" - Archimedes





More information about the plug mailing list