How to copy /usr to another drive

How to copy /usr to another drive

Post by Dave Hwa » Sat, 20 May 1995 04:00:00



   Hello,
     I've gotten a new scsi drive and want
   to move my /usr directory to it, but
   don't know how to preserve the hardlinks?
   Really, I'm not even sure of the issues
   involved, anyhow, this is how I'm
   attempting it.

     So far I have the scsi drive mounting
   in /mnt and have created a directory
   in it called usr.  I'm sure it's mounting,
   mount shows it.  Then I'm trying to
   cp -r -p -d /usr/* /mnt/usr/ . It goes
   and seems to work, but complains along
   the way about not being able to copy
   the links.

Try this from your root (/) directory.

        tar cf - usr | (cd /mnt ; tar xvf -)

That will preserve your links... cp -r will follow your links and copy what
it's pointing to, not the link. and if you happened to have some sort of loop,
well...

Dave Hwang

 
 
 

How to copy /usr to another drive

Post by OZAWA Saku » Sat, 20 May 1995 04:00:00


schoiack> Hello,
schoiack>   I've gotten a new scsi drive and want
schoiack> to move my /usr directory to it, but
schoiack> don't know how to preserve the hardlinks?

        tar cvf - /usr | (cd /newusr; tar xvf -)

makes sense?

--


 
 
 

How to copy /usr to another drive

Post by schoi.. » Sat, 20 May 1995 04:00:00


Hello,
  I've gotten a new scsi drive and want
to move my /usr directory to it, but
don't know how to preserve the hardlinks?
Really, I'm not even sure of the issues
involved, anyhow, this is how I'm
attempting it.

  So far I have the scsi drive mounting
in /mnt and have created a directory
in it called usr.  I'm sure it's mounting,
mount shows it.  Then I'm trying to
cp -r -p -d /usr/* /mnt/usr/ . It goes
and seems to work, but complains along
the way about not being able to copy
the links.  Most of the files seem to
make it okay though?  After that
I rename /usr to /usr2 and create a
softlink ln -s /mnt/usr /usr which
seems to work ok. Next, I'm trying
to run setup, so that I can install the
base -- or most of the 'a' disk series
again, hoping it will create the links
that didn't make it in the copy.

  But setup nor pkgtool will run for
me..  Moving directories seems like
it be a common chore for sys admins,
but it sure isn't working for me?!?

  Anyhow, I'd really appreciate any
ideas/suggestions -- short of
reinstalling with my scsi drive
mounted originally as /usr :) ..

Thank you, and take care...

Chris Van Schoiack
CS major

 
 
 

How to copy /usr to another drive

Post by David C. Snyd » Sat, 20 May 1995 04:00:00


Hello,



:   schoiack> Hello,
:   schoiack>   I've gotten a new scsi drive and want
:   schoiack> to move my /usr directory to it, but
:   schoiack> don't know how to preserve the hardlinks?

:       tar cvf - /usr | (cd /newusr; tar xvf -)

:   makes sense?

No, this doesn't make sense.  I tried it, and you end up with a directory
structure that looks like /newuser/usr/....  Things could be worse.  GNU tar
is kind enough to remove the leading '/' from the pathnames in the archive.
Other tar's would use the absolute path names when extracting and probably
re-write every file under /usr, putting nothing in /newuser.  Below is what I
believe to be the correct way to do this using tar(1):

   (the new SCSI drive is temporarily mounted under /mnt)

   cd /usr
   tar cf - . | (cd /mnt; tar xvpf -)

GNU tar is smart enough to handle hard links as well as symbolic links
correctly.  The 'p' is necessary to preserve file permission modes.

-- David

 
 
 

How to copy /usr to another drive

Post by Uwe Bonn » Sat, 20 May 1995 04:00:00



> Hello,
>   I've gotten a new scsi drive and want
> to move my /usr directory to it, but
> don't know how to preserve the hardlinks?
> Really, I'm not even sure of the issues
> involved, anyhow, this is how I'm
> attempting it.

> ...

>   Anyhow, I'd really appreciate any
> ideas/suggestions -- short of
> reinstalling with my scsi drive
> mounted originally as /usr :) ..

What about:
>su
>cd /
>mkfifo /tmp/fifo.tar
>tar fc /tmp/fifo.tar usr &
>cd /mnt
>tar fx /tmp/fifo.tar

I tried it with the last command as

Quote:>tar ft /tmp/fifo

Tar sustains all links. If you have something like
Quote:> ls -l link

  ....  link -> /usr/file1,
the link isn't valid as long as the new image isn't mounted as /usr.
Hope this works for you.
--

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

 
 
 

How to copy /usr to another drive

Post by Mihail Ioto » Sat, 20 May 1995 04:00:00




>   Hello,
>     I've gotten a new scsi drive and want
>   to move my /usr directory to it, but
>   don't know how to preserve the hardlinks?
>   Really, I'm not even sure of the issues
>   involved, anyhow, this is how I'm
>   attempting it.

>     So far I have the scsi drive mounting
>   in /mnt and have created a directory
>   in it called usr.  I'm sure it's mounting,
>   mount shows it.  Then I'm trying to
>   cp -r -p -d /usr/* /mnt/usr/ . It goes
>   and seems to work, but complains along
>   the way about not being able to copy
>   the links.

>Try this from your root (/) directory.

>    tar cf - usr | (cd /mnt ; tar xvf -)

>That will preserve your links... cp -r will follow your links and copy what
>it's pointing to, not the link. and if you happened to have some sort of loop,
>well...

cp -rpd has worked for me.

- Show quoted text -

>Dave Hwang


 
 
 

How to copy /usr to another drive

Post by Juha Virtan » Sat, 20 May 1995 04:00:00


:>   tar cvf - /usr | (cd /newusr; tar xvf -)

I've done it this vay:

umask 000; cd /usr; tar -cSf - . | tar -xvSpC /mnt/usr -f -; umask 022

-S saves holes in files and -p preserves ownership and
permissions, umask 000 is there only to be sure.

Juha
--
-----------------------------------------------------------------

 
 
 

How to copy /usr to another drive

Post by Steffen R. Muell » Tue, 23 May 1995 04:00:00


: Hello,
:   I've gotten a new scsi drive and want
: to move my /usr directory to it, but
: don't know how to preserve the hardlinks?
: Really, I'm not even sure of the issues
: involved, anyhow, this is how I'm
: attempting it.

Generally it is NOT recommendet to use cp for moving directory trees around.
One reason are the link problems etc etc...

An easy way to overcome this is to use tar in a pipe !

Let's asume you'd like move your /usr directory to another drive wich is
mounted under /newdrive

then try

tar cf - /usr/* | (cd /newdrive; tar xvf -)

This method will save all links and can be used to move complete directory
trees around.

Bye

Steffen
--
--------------------------------------------------------------------------
Steffen R. Mueller      Tel    : +49-721-9812020

76137 Karlsruhe         Fax    : +49-721-814057
Germany                 WWW    : http://www.schiele-ct.de/steffen.html
--------------------------------------------------------------------------

 
 
 

How to copy /usr to another drive

Post by Arie Maaska » Tue, 23 May 1995 04:00:00




>: Hello,
>:   I've gotten a new scsi drive and want
>: to move my /usr directory to it, but
>: don't know how to preserve the hardlinks?
>Generally it is NOT recommendet to use cp for moving directory trees around.
>One reason are the link problems etc etc...
>An easy way to overcome this is to use tar in a pipe !
>Let's asume you'd like move your /usr directory to another drive wich is
>mounted under /newdrive
>tar cf - /usr/* | (cd /newdrive; tar xvf -)
>This method will save all links and can be used to move complete directory
>trees around.

I thought, still better would be ( as a super-user ):
Mount the new usr-device to /mnt
Go to /usr:
Do:
tar cf - . | ( cd /mnt ; tar xpf - )

Th p-flag is to restore the mode-information of the files, including
sticky-bits and SETUID information. Better not use the v-flag it only
slows it down.

--
Arie Maaskant                   University of Amsterdam

Phone: +31 20 525 6438          Plantage Muidergracht 24
Fax:   +31 20 525 5101          1018 TV Amsterdam

 
 
 

How to copy /usr to another drive

Post by Gilgames » Tue, 23 May 1995 04:00:00


What wrong with just using cp -a ?

                        -Ben Greenwald

 
 
 

1. how to copy / without copying /var, /usr, etc.

I am moving my OS to a new drive. I am trying to copy
/ using cp -r but the /usr, /var also get copied.
I have mounted those partitions as /newusr /newvar on
the new drive.

How does one copy only the files resident on the /
partition, including directories, without copying
/usr, /var (which exist on their own respective partitions).

Your help will be appreciated. Thanks in advance.

Sent via Deja.com http://www.deja.com/
Before you buy.

2. What is this mysterious field in the new DHCP files?

3. New HDD copy; using "Drive Copy" program (W98) to dupe Linux

4. mksysb fails exit code 2

5. Hard freezes in linux alpha whe using sound.

6. How can I set up routing for a DialIn PPP user, and he uses a different IP Block to mine.

7. copying hard drive to hard drive

8. How do I copy Linux from faulty drive to another identical (working) drive?

9. How copy/backup entire drive to another drive?

10. how to copy multiple small drives to one large drive?

11. Hard Drive to Hard Drive Copy