Re: Migrating /home from too small /dev/hda partition
[email protected] Mon, 11 Aug 2003 05:37:54 -0700
| Newsgroups | gmane.linux.hardware.sony |
|---|---|
| Message-ID | <[email protected]> |
> Jean Delvare <[email protected]> said: > > > cd /opt/home > > tar cf - . | ( cd /home; tar xpf -) > > > > This insures all files keep their ownerships and permissions intact. > > You can then delete /opt/home when you are done. > > I believe that "cp -a" does just the same, in an easier manner. Agreed. I usually do the tar pipe trick, since versions of cp on a number of Unices do not support the -a switch. This makes the tar approach portable on systems with only POSIX compliant cp commands. The tar trick also gives you more control over file permission access and who runs the command. For example to copy a directory tree from a remote directory and preserve permissions where you have read access to a remote directory tree, but not root access on the remote system, you can do: (ssh remote_system tar cf - /dir) | ( cd /local_dir; sudo tar xpf - ) You cannot do this with cp or even scp easily. -- Smoot Carl-Mitchell Systems/Networking Consultant email: [email protected] cell: +1 602 421 9005 home: +1 480 922 7313