Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Dec 2006 14:38:10 -0800
From:      "Loren M. Lang" <lorenl@alzatex.com>
To:        Jerry McAllister <jerrymc@msu.edu>
Cc:        freebsd-questions@freebsd.org, Lisa Casey <lisa@jellico.com>
Subject:   Re: Moving /var/mail
Message-ID:  <20061201223810.GC24590@alzatex.com>
In-Reply-To: <20061201202248.GC11235@gizmo.acns.msu.edu>
References:  <001a01c7157d$cb9feee0$d5b9bfcf@lisac> <20061201202248.GC11235@gizmo.acns.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--+nBD6E3TurpgldQp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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:
>=20
> > Hi,
> >=20
> > I want to move /var/mail to /usr/var/mail, then symlink /var/mail to=20
> > /usr/var/mail to free up space on my (too small on this machine) /var. =
Of=20
> > course, I wish to maintain file permissions, ownerships, etc. I decided=
 to=20
> > try a dry run using a user home directory first to make sure this would=
=20
> > work right. Good thing I did...
> >=20
> > I created /usr/kellyw  and attempted to copy the contents of  /home/kel=
lyw/=20
> > to it. First of all, I tried tar cvpf /usr/kellyw/kellyw.tar /home/kell=
yw/
> >=20
> > When I unpack the tar file, I wind up with /usr/kellyw/home/kellyw/*  N=
ot=20
> > what I wanted. I wanted all of the files in /home/kellyw/ to wind up in=
=20
> > /usr/kellyw/
> >=20
> > So I then tried to just copy the files using cp -p but I can't get the=
=20
> > syntax right on that:
> >=20
> > # 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.
>=20
> 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.

>=20
> If it has subdirectories and you want it to recurse, then
> do this:      cp -R -p /home/kellyw/ /usr/kellyw
>=20
> Unfortunately, if there are hard links in that directory, it will also=20
> 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.

>=20
> You might want to consider using tar instead of cp if your file structure
> to be moved are at all complex.
>=20
>    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 *                  =20

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

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

--=20
Loren M. Lang
lorenl@alzatex.com
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
=20

--+nBD6E3TurpgldQp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFFcK7SSHsHRHUO+igRAj3lAKCkR9ECzUCdobceWpUjDfdb/wqUiACfe2ic
O5bpOn08VzE+Dbhsb84EXy4=
=+YBt
-----END PGP SIGNATURE-----

--+nBD6E3TurpgldQp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061201223810.GC24590>