On Fri, Dec 01, 2006 at 03:22:48PM -0500, Jerry McAllister wrote:
> On Fri, Dec 01, 2006 at 02:20:42PM -0500, Lisa Casey wrote:
> 
> > Hi,
> > 
> > I want to move /var/mail to /usr/var/mail, then symlink /var/mail to 
> > /usr/var/mail to free up space on my (too small on this machine) /var. Of 
> > course, I wish to maintain file permissions, ownerships, etc. I decided to 
> > try a dry run using a user home directory first to make sure this would 
> > work right. Good thing I did...
> > 
> > I created /usr/kellyw  and attempted to copy the contents of  /home/kellyw/ 
> > to it. First of all, I tried tar cvpf /usr/kellyw/kellyw.tar /home/kellyw/
> > 
> > When I unpack the tar file, I wind up with /usr/kellyw/home/kellyw/*  Not 
> > what I wanted. I wanted all of the files in /home/kellyw/ to wind up in 
> > /usr/kellyw/
> > 
> > So I then tried to just copy the files using cp -p but I can't get the 
> > syntax right on that:
> > 
> > # cd /home/kellyw
> > # ls -l
> > total 16
> > -rw-r--r--  1 kellyw  kellyw  767 Aug 18 14:52 .cshrc
> > -rw-r--r--  1 kellyw  kellyw  248 Aug 18 14:52 .login
> > -rw-r--r--  1 kellyw  kellyw  158 Aug 18 14:52 .login_conf
> > -rw-------  1 kellyw  kellyw  373 Aug 18 14:52 .mail_aliases
> > -rw-r--r--  1 kellyw  kellyw  331 Aug 18 14:52 .mailrc
> > -rw-r--r--  1 kellyw  kellyw  797 Aug 18 14:52 .profile
> > -rw-------  1 kellyw  kellyw  276 Aug 18 14:52 .rhosts
> > -rw-r--r--  1 kellyw  kellyw  975 Aug 18 14:52 .shrc
> > # cp -p /home/kellyw/* /usr/kellyw/*
> > cp: No match.
> > # cp -p /home/kellyw/ /usr/kellyw/
> > cp: /home/kellyw/ is a directory (not copied).
> > # cp -p /home/kellyw/*.* /usr/kellyw/*.*
> > cp: No match.
> 
> You don't want to use the '*' on the receiving directory.
> If there are no other subdirectories in /home/kellyw then
> just do this:    cp -p /home/kellyw/* /usr/kellyw/.

This will miss hidden files which a home directory will surely have.
Just drop the * to copy everything.

> 
> If it has subdirectories and you want it to recurse, then
> do this:      cp -R -p /home/kellyw/ /usr/kellyw
> 
> Unfortunately, if there are hard links in that directory, it will also 
> make new copies of those files rather than just making new hard links.

The whole point of this is because the original partition was getting
too full so unless all links to the file are copied, it will have to
make new copies of the files.  If there are multiple hard links to the
same file that need to be removed, then tar, pax, or cpio should be
used. /var/mail probably won't have any nor /home/kellyw unless kellyw
specifically set them up with ln.

> 
> You might want to consider using tar instead of cp if your file structure
> to be moved are at all complex.
> 
>    cd /home/kellyw
>    tar cvpf /usr/kellyw/kelly.tar *

 * should be . to copy everything

>    cd /usr/kellyw
>    tar xvpf kelly.tar
>    rm kelly.tar
>    cd /home/kellyw
>    pwd            (just to be extra careful since rm -rf * is irrevocable)
>    rm -rf *                   

To remove everything you would have to be up one and remove the folder
instead.

> 
> ////jerry
> 
> > 
> > Can someone help me out with my syntax? The tar method would probably be 
> > better (I guess) though I don't really care  which method I use as long as 
> > it works (and preserves permissions, etc.). There are only about 60 
> > mailboxes on this system.
> > 
> > Thanks,
> > 
> > Lisa Casey
> > 
> > _______________________________________________
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "[EMAIL PROTECTED]"
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
> 

-- 
Loren M. Lang
[EMAIL PROTECTED]
http://www.alzatex.com/


Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc
Fingerprint: CEE1 AAE2 F66C 59B5 34CA  C415 6D35 E847 0118 A3D2
 

Attachment: pgpKoiZsGT0Xr.pgp
Description: PGP signature

Reply via email to