[comp.sys.hp] Copying disks

paulc@hpfcdc.HP.COM (Paul Christofanelli) (04/07/90)

Just happened to be around, so...

With different size disks, dd won't work correctly.  If you go from the
57 to the 58, you'll effectively turn your 58 into a 57 as far as
available FS space goes.  In other words, the size info is part of the
file system.  You'd end up with a lot more available swap space on the
58, however, since everything after the file system is swap space.

Anyway, assuming you don't want the above, the standard way of doing this
is (as root, of course):

* newfs the new (destination) disk (the 58?) with the disktab entry that
    gives you the desired swap space.

* mount the destination disk (say on "/disc").

* cd /  (or, if source is mounted somewhere else, cd to there).

*  find . -hidden -mountstop -print | cpio -ox | (cd /disc; cpio -idumx) &

   ("&" so you can look at the destination disk as the copy is proceeding)

   The "-hidden" option copies CDFs, very important if it's a diskless server.
   The "-mountstop" option, of course, avoids a recursive mess.
   I don't use the "-p" option of cpio because it used to not work with
   symlinks, although that's probably been fixed by now.

* umount /disc

I don't know of any easy way with cpio or tar to preserve directory
modification times.  I think I had to write a C program to do this once.
The ctime can't be preserved.

I've tried tar before for this, but I've had it act a bit flaky.  Notice that
you must use something like tar NHcf - . | (cd /disc; tar xvf -) to get hidden
directories and device files.  This doesn't work around the recursive copy
problem, though; the "." in the above command would have to be replaced by
a specific list of files and directories to copy.

-Paul Christofanelli

campbelr@hpclove.HP.COM (Bob Campbell) (04/07/90)

dd works great if the partitions being copied are identical.

Why not use cpio to do the transfer.  With disks mounted at /new and /old:

cd /old
find . -depth -print | cpio -pxmdv /new

Check a man page near you for more information.
--------------------------------------------------------------------------
Bob Campbell                Some times I wish that I could stop you from 
campbelr@hpda.hp.com        talking, when I hear the silly things you say.
Hewlett Packard                                    - Elvis Costello

garvey@cmic.UUCP (Joe Garvey) (04/08/90)

In article <3770046@hpclove.HP.COM>, campbelr@hpclove.HP.COM (Bob Campbell) writes:
> dd works great if the partitions being copied are identical.
> 
> Why not use cpio to do the transfer.  With disks mounted at /new and /old:
> 
> cd /old
> find . -depth -print | cpio -pxmdv /new
 
Don't forget hidden directories!!!

to move files in mass: (I've used this lotsa times.)

first: cd dir_in_question
second: find . -hidden -print > /tmp/tmp_file
third: cat /tmp/tmp_file | cpio -pdxumv new_dir

I often need to edit out a group of files (directories), which I do between
steps two and three. I also review what's to be moved so I'm sure I haven't
missed anything. Can't be too careful when moving a whole file system, esp
the root file system.

--

Joe Garvey                       UUCP: {apple,backbone}!versatc!mips!cmic!garvey
California Microwave             Internet: garvey%cmic@mips.com
990 Almanor Ave                  HP Desk: garvey (cmic@mips.com) /hp1900/ux
Sunnyvale, Ca, 94086 
408-720-6439 (let it ring)