[comp.unix.aux] Copying A/UX to another disk

dundas@granite.jpl.nasa.gov (John Dundas) (04/18/91)

Please help!  I did this once but can't seem to remember how now!  I want to
copy my entire root file system onto another (larger) disk.  I seem to
remember using a pipe like:

	find / -print | cpio -pdl /something

but this isn't working.  The actual command I am using is:

	find / -depth -print | cpio -pdl /dev/rdsk/c1d0s0

but when issued, this command complains that it 
"cannot write in </dev/rdsk/c1d0s0>"
(I am root when trying).  Any suggestions?

John Dundas
dundas@salt.jpl.nasa.gov

sukes@eng.umd.edu (Tasuki Hirata) (04/18/91)

In article <1991Apr17.173127.15460@jato.jpl.nasa.gov> dundas@granite.Jpl.Nasa.Gov (John Dundas) writes:
>Please help!  I did this once but can't seem to remember how now!  I want to
>copy my entire root file system onto another (larger) disk.  I seem to
>remember using a pipe like:
>
>	find / -print | cpio -pdl /something
>
>but this isn't working.  The actual command I am using is:
>
>	find / -depth -print | cpio -pdl /dev/rdsk/c1d0s0
>
>but when issued, this command complains that it 
>"cannot write in </dev/rdsk/c1d0s0>"
>(I am root when trying).  Any suggestions?
>
>John Dundas
>dundas@salt.jpl.nasa.gov

How about mounting the partition on /mnt and saying something like,

	cd /
	find . -print | grep -v ^./mnt | cpio -pdl /mnt


--
| Tasuki Hirata (sukes@eng.umd.edu) | - This page intentionally left blank - |
| UUCP: uunet!eng.umd.edu!sukes     | 					     |

dundas@granite.jpl.nasa.gov (John Dundas) (04/18/91)

Thanks to all those that replied!  I believe that the problem is being cured
as I write this message.  In short, mount the newly created file system on
/mnt, and modify the pipe to include a grep -v /mnt, finally change the cpio
destination to /mnt.  The altered command looks something like:

	find / -print | grep -v /mnt | cpio -pdlm /mnt

Thanks to all!

John Dundas

alexis@panix.uucp (Alexis Rosen) (04/19/91)

dundas@granite.Jpl.Nasa.Gov (John Dundas) writes:
>I want to copy my entire root file system onto another (larger) disk.
>I seem to remember using a pipe like:
>	find / -print | cpio -pdl /something
>but this isn't working.  The actual command I am using is:
>	find / -depth -print | cpio -pdl /dev/rdsk/c1d0s0
>but when issued, this command complains that it 
>"cannot write in </dev/rdsk/c1d0s0>"
>(I am root when trying).  Any suggestions?

The problem with this is that you have to copy onto a mounted filesystem.
But if you mount the disk, it will be found by find, and you'll have an
infinite loop (you'll see that that disk isn't nearly as big as you though :-).

So what you want to do is this:
1) Make sure the new disk (and any others, if you have any) is UNmounted.
2) cd / ; find . -depth -print >tmp/files	# (Make the list of files)
   mount /mnt /dev/dsk/c1d0s0			# mount your new disk
   cpio -idm /mnt </tmp/files			# move over files

That's it. BTW, the -m flag to cpio is VERY important. Without it all the
files will take on the current date. You _don't_ want this.

---
Alexis Rosen
Owner/Sysadmin, PANIX Public Access Unix, NY
{cmcl2,apple}!panix!alexis

sysmark@aurora.physics.utoronto.ca (Mark Bartelt) (04/22/91)

In article <1991Apr18.135204.11057@jato.jpl.nasa.gov>
dundas@granite.Jpl.Nasa.Gov (John Dundas) writes:

| Thanks to all those that replied!  I believe that the problem is being cured
| as I write this message.  In short, mount the newly created file system on
| /mnt, and modify the pipe to include a grep -v /mnt, finally change the cpio
| destination to /mnt.  The altered command looks something like:
| 
|	find / -print | grep -v /mnt | cpio -pdlm /mnt

Well, "something like" ought to be something more like

	find / -print | egrep -v '^/mnt$|^/mnt/' | cpio -pdlm /mnt

to make sure that things like

	/mntx/spam
and
	/foo/mnt/bar

get copied to the new filesystem.

Mark Bartelt                                                    416/978-5619
Canadian Institute for                                 mark@cita.toronto.edu
Theoretical Astrophysics                               mark@cita.utoronto.ca

tony@tui.marcam.dsir.govt.nz (Tony Cooper) (04/23/91)

|> |	find / -print | grep -v /mnt | cpio -pdlm /mnt
|> 
|> Well, "something like" ought to be something more like
|> 
|> 	find / -print | egrep -v '^/mnt$|^/mnt/' | cpio -pdlm /mnt
|> 
Well neither of the two is correct. Neither "copies" A/UX to another disk.
They both change the files in subtle ways. Files on both filesystems are
changed in fact and both filesystems are not identical. The only way to make
a copy is by using dump. Dump to tape then restore to disk. Then only two
files get changed on both filesystems (namely the raw disk special files)
and both filesystems are otherwise identical.

To make the copies as identical as possible using cpio use the arguments
cpio -pudlma. The a means that the copied files get their access times
reset to be the same as the original files, the u doesn't mean anything
when copying to a blank disk but is necessary when copying to an existing
filesystem (it ensures that existing files get overwritten).

Using dump is the standard way on the unix world. Users don't like having
their files altered by sysadmins. (NB only the file dates get altered, not
file contents). And if you alter the last access date of users' files you
can never say to them "Look, you have 10MB of data that you have not
accessed for two years. Shouldn't you archive that onto tape?".

Tony Cooper

jim@jagubox.gsfc.nasa.gov (Jim Jagielski) (04/23/91)

In article <1991Apr23.010830.5923@am.dsir.govt.nz> sramtrc@albert.dsir.govt.nz writes:
}
}|> |	find / -print | grep -v /mnt | cpio -pdlm /mnt
}|> 
}|> Well, "something like" ought to be something more like
}|> 
}|> 	find / -print | egrep -v '^/mnt$|^/mnt/' | cpio -pdlm /mnt
}|> 
}Well neither of the two is correct. Neither "copies" A/UX to another disk.
}They both change the files in subtle ways. Files on both filesystems are
}changed in fact and both filesystems are not identical. The only way to make
}a copy is by using dump. Dump to tape then restore to disk. Then only two
}files get changed on both filesystems (namely the raw disk special files)
}and both filesystems are otherwise identical.
}
}Using dump is the standard way on the unix world. Users don't like having
}their files altered by sysadmins. (NB only the file dates get altered, not
}file contents). And if you alter the last access date of users' files you
}can never say to them "Look, you have 10MB of data that you have not
}accessed for two years. Shouldn't you archive that onto tape?".
}

Yep, dump is good, but I seem to recall (it's been awhile though :) that dump
also "copies" the SuperBlock info, meaning that the sizes of the FileSystems
MUST be the same. That is, if you want to "copy" a 55MB Root FS to a new
100MB partition, you can't use dump since the sizes are the same. In this case,
you must use a file-oriented utility, such as cpio.
--
===========================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagubox.gsfc.nasa.gov               Greenbelt, MD 20771

 "I object to all this sex on the television. I mean, I keep falling off!"

jim@jagubox.gsfc.nasa.gov (Jim Jagielski) (04/23/91)

In article <5032@dftsrv.gsfc.nasa.gov> I ramble:
}In article <1991Apr23.010830.5923@am.dsir.govt.nz> Tony Cooper writes:
}}
}}|> |	find / -print | grep -v /mnt | cpio -pdlm /mnt
}}|> 
}}|> Well, "something like" ought to be something more like
}}|> 
}}|> 	find / -print | egrep -v '^/mnt$|^/mnt/' | cpio -pdlm /mnt
}}|> 
}}Well neither of the two is correct. Neither "copies" A/UX to another disk.
}}They both change the files in subtle ways. Files on both filesystems are
}}changed in fact and both filesystems are not identical. The only way to make
}}a copy is by using dump. Dump to tape then restore to disk. Then only two
}}files get changed on both filesystems (namely the raw disk special files)
}}and both filesystems are otherwise identical.
}}
}
}Yep, dump is good, but I seem to recall (it's been awhile though :) that dump
}also "copies" the SuperBlock info, meaning that the sizes of the FileSystems
}MUST be the same. That is, if you want to "copy" a 55MB Root FS to a new
}100MB partition, you can't use dump since the sizes are the same. In this case,
}you must use a file-oriented utility, such as cpio.

Well, I goofed! I was actually thinking of volcopy and NOT dump.bsd concerning
the SB stuff.

Using dump.bsd IS the way to make exact copies of file systems, but you don't
even need tape, as Tony says. Make your new file system and then mount it on
/mnt... now to copy root over just type:

	$ dump.bsd 0f - /dev/rdsk/c0d0s0 | ( cd /mnt; restore xf - )

Using a pipe removes the need for any external storage...
--
===========================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagubox.gsfc.nasa.gov               Greenbelt, MD 20771

 "I object to all this sex on the television. I mean, I keep falling off!"