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

Re: cp -a

On Sat, 24 Jan 1998, Santiago Vila Doncel wrote:

> On Fri, 23 Jan 1998, Ulisses Alonso Camaro wrote:
> > I would like to know why cp -aR is not useful to replicate a disk
> Since cp -a [*] is useful to replicate a disk, I think you are really
> asking "I would like to know why some people seem to prefer tar or cpio
> to replicate a disk".
> Well, I don't know the answer, but in either case, you have often to be
> careful to avoid infinite recursive copying:
> cd /
> mount /dev/somedisk /mnt
> cp -a * /mnt
> See the mess? ( /mnt/mnt/mnt/... )

You could add the -x switch. This skips subdirectories that are not on the
same filesystem as the directories you are copying.

cp -ax / /mnt

would only copy the root filesystem to /mnt and not things like /proc, an
accidentally mounted floppy or a /usr which is on a different filesystem.
If /usr is on a different filesystem, simply do

cp -ax / /usr /mnt

to copy both filesystems to /mnt .


TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: