[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Copying a partition, was Re: ** Emegancy Request **



Quoting Bill (bill@willco.org):

>             Can someone please tell me the easiest and safest way to mirror
> a Hard Drive,  keeping all permissions, owner, groups etc. intact

Well I wouldn't call "man dd" a safe way of doing this unless you mean
you want to make a bit for bit copy of the disk. If that's the case,
then you don't need to worry about permissions, owner, groups etc.
because it's not even going to worry about what sort of partitions or
filesystems you have. I've never done it though; you're on your own.

But I'll assume that you really want to copy the contents of a partition
from one disk to another. If that's so, then:

mke2fs /dev/new-partition     which will create the lost+found directory
                              of the correct size

mount /dev/new-partition /mnt

cd to the top (mount point) of the old partition (which might be /)

find -xdev | cpio -damp /mnt

That will copy everything in that partition, correctly.

What will differ: Directories will have new timestamps and they will
be just big enough for the files contained therein (the old ones may
have contained more files at one time).

What still needs doing: You may need to adjust /etc/fstab if the changes
you make result in different device names.
If this was a root (/) partition and you use lilo, you will need to boot
to it (with a floppy, say) and run lilo. I'm told you can avoid booting
by using chroot or lilo -r but I haven't actually done this.

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.



Reply to: