Moving /var/mail
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. 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]
Re: Moving /var/mail
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'm a little confused... if you want to move /var/mail to /usr/var/mail why are you messing around with /home at all? This is what I would do... ... stop your smtp program ... stop your pop/imap program tar zcvpf /tmp/varmail.tpgz /var/mail mkdir -p /usr/var mv /var/mail /usr/var/mail ln -s /usr/var/mail /var/mail ... restart your smtp/pop/imap programs... 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. 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]
Re: Moving /var/mail
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/. 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. 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 * 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 * 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]
Re: Moving /var/mail
On Fri, Dec 01, 2006 at 02:22:01PM -0600, Philip Hallstrom wrote: 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'm a little confused... if you want to move /var/mail to /usr/var/mail why are you messing around with /home at all? That is just her test case, not the real one she wants to do after she is comfortable with the process. jerry This is what I would do... ... stop your smtp program ... stop your pop/imap program tar zcvpf /tmp/varmail.tpgz /var/mail mkdir -p /usr/var mv /var/mail /usr/var/mail ln -s /usr/var/mail /var/mail ... restart your smtp/pop/imap programs... 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. 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] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Moving /var/mail
Hi Phillip, I'm a little confused... if you want to move /var/mail to /usr/var/mail why are you messing around with /home at all? As I said - that was a dry run to see if this would work the way I thought it would (it didn't). I'ld rather practice with a users home directory that isn't important than risk screwing up people's mail boxes. This is what I would do... ... stop your smtp program ... stop your pop/imap program tar zcvpf /tmp/varmail.tpgz /var/mail mkdir -p /usr/var mv /var/mail /usr/var/mail ln -s /usr/var/mail /var/mail ... restart your smtp/pop/imap programs... Thanks. I'll try this tomorrow. On a users home directory first... Lisa Casey ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Moving /var/mail
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. 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. You could do something like this[1]: # tar -cvf - -C /home/kellyw . | tar -xpBf - -C /usr/kellyw Regards, Mikhail. [1] - Taken from 'man tar', EXAMPLES section. -- Mikhail Goriachev Webanoide Telephone: +61 (0)3 62252501 Mobile Phone: +61 (0)4 38255158 E-Mail: [EMAIL PROTECTED] Web: http://www.webanoide.org PGP Key ID: 0x4E148A3B PGP Key Fingerprint: D96B 7C14 79A5 8824 B99D 9562 F50E 2F5D 4E14 8A3B ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Moving /var/mail
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 pgpKoiZsGT0Xr.pgp Description: PGP signature
moving /var/mail to another machine
Hi, I want to move all of the mailboxes (all of /var/mail/*) on one machine to another one across a network. I need to preserve permissions, uid's and gud's. (It would probably be good to preserve modification times as well). I can move a file using scp, but it doesn't preserve uid/gid I found this page: http://www.unixguide.net/ibm/faq/faq1.604.shtml which says I can do either: $rsh RemoteHost cd TargetDir; tar -cBf - . | tar -xvBf - or rcp -rp host1:/dir host2:/dir I'm trying it using a users home directory first just to make sure I can get this right, but so far I'm not having much luck. Could someone here suggest the best way for me to move these mailboxes (and perhaps help me out a little with the actual syntax of the command I would use)? I realise that there will be a problem with mailboxes that don't have usernames on the remote system (the system I'm copying the mailboxes to) but most of the users currently exist on the remote system, it will be easy enough to do a adduser to add in those that aren't already on there. I hope I'm explaining myself clearly here, it's been a long day already :-) Thanks, Lisa -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.322 / Virus Database: 266.11.16 - Release Date: 5/24/2005 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: moving /var/mail to another machine
At 7:24 PM -0400 5/24/05, Lisa Casey wrote: Hi, I want to move all of the mailboxes (all of /var/mail/*) on one machine to another one across a network. I need to preserve permissions, uid's and gud's. (It would probably be good to preserve modification times as well). I can move a file using scp, but it doesn't preserve uid/gid Check the port named net/rsync . You can sync a directory from one machine to another over ssh by using it. -- Garance Alistair Drosehn= [EMAIL PROTECTED] Senior Systems Programmer or [EMAIL PROTECTED] Rensselaer Polytechnic Instituteor [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: moving /var/mail to another machine
On May 24, 2005, at 5:24 PM, Lisa Casey wrote: Hi, I want to move all of the mailboxes (all of /var/mail/*) on one machine to another one across a network. I need to preserve permissions, uid's and gud's. (It would probably be good to preserve modification times as well). I can move a file using scp, but it doesn't preserve uid/gid Can't you just do cd /var/mail tar cpf /tmp/var_mail.tar * scp /tmp/var_mail.tar [EMAIL PROTECTED]: ssh to the new host cd /var/mail rm -rf *# if you want to clean out the existing /var/mail on the new machine tar xpf ~user:var_mail.tar Chad ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: moving /var/mail to another machine
Garance A Drosihn wrote: At 7:24 PM -0400 5/24/05, Lisa Casey wrote: Hi, I want to move all of the mailboxes (all of /var/mail/*) on one machine to another one across a network. I need to preserve permissions, uid's and gud's. (It would probably be good to preserve modification times as well). I can move a file using scp, but it doesn't preserve uid/gid Check the port named net/rsync . You can sync a directory from one machine to another over ssh by using it. You could also tar it with -p. which would preserve the permissions, and then scp it, but rsync is probably a better idea. James ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: moving /var/mail to another machine
On May 24, 2005, at 6:40 PM, Chad Leigh -- Shire.Net LLC wrote: On May 24, 2005, at 5:24 PM, Lisa Casey wrote: Hi, I want to move all of the mailboxes (all of /var/mail/*) on one machine to another one across a network. I need to preserve permissions, uid's and gud's. (It would probably be good to preserve modification times as well). I can move a file using scp, but it doesn't preserve uid/gid Can't you just do cd /var/mail tar cpf /tmp/var_mail.tar * scp /tmp/var_mail.tar [EMAIL PROTECTED]: ssh to the new host cd /var/mail rm -rf *# if you want to clean out the existing /var/mail on the new machine tar xpf ~user:var_mail.tar sorry typo above should be tar xpf ~user/var_mail.tar Chad Chad ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions- [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: moving /var/mail to another machine
Chad Leigh -- Shire.Net LLC wrote: On May 24, 2005, at 6:40 PM, Chad Leigh -- Shire.Net LLC wrote: On May 24, 2005, at 5:24 PM, Lisa Casey wrote: Hi, I want to move all of the mailboxes (all of /var/mail/*) on one machine to another one across a network. I need to preserve permissions, uid's and gud's. (It would probably be good to preserve modification times as well). I can move a file using scp, but it doesn't preserve uid/gid Can't you just do cd /var/mail tar cpf /tmp/var_mail.tar * scp /tmp/var_mail.tar [EMAIL PROTECTED]: ssh to the new host cd /var/mail rm -rf *# if you want to clean out the existing /var/mail on the new machine tar xpf ~user:var_mail.tar sorry typo above should be tar xpf ~user/var_mail.tar Chad Chad ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions- [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] you need to use tar-cvpf /usr/local/archive.tar /var/mail to preserve the permissions. then, youre cool. Jamie ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]