Tim Peeler on Mon, 31 Dec 2001 15:20:14 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Copying ext2 data partitions


On Mon, Dec 31, 2001 at 08:28:29AM -0500, Michael F. Robbins wrote:
> As I prepare to install Debian in the production setting (see earlier
> msesages :-), I plan to backup all my /home and other critical files to
> another partition, one that will not be used (immediately) by Debian.
> 
> My current plan is:
> (BOOT FROM tomsrtbt OR SIMILAR)
> mkdir /mnt/backup
> mkdir /mnt/home
> mount /dev/hda1 /mnt/home
> mount /dev/hdb1 /mnt/backup
> cp -a /mnt/home /mnt/backup/
> 
> The core part of this being the "-a" option of cp.  "-a" is the same as
> "-dpR", which is:
> * Don't dereference symlinks, and dont follow them.  Just copy symlinks
> as symlinks.
> * "preserve file attributes if possible"
> * and recurse
> 
> It is VERY important that permissions and structure get preserved... 
> The man page says "if possible", any hints on that?  (Will I get errors
> if it for some reason CANT preserve permissions on a particular file? I
> doubt it.)  So is there an option I'm missing, or is there a better way
> to do this alltogether?
> 
> Counting down to production Debian install...
> Mike

root@foo# cd /mnt/backup
root@foo# (cd /mnt/home ; tar --same-owner -cpf - .) | tar --same-owner -xpf -

will that do?  i'm not sure if that will preserve everything. you may
try --numeric-owner as well.  

Actually, you should really try rsync.  It will do exactly what you
want, but may not be available on tomsrtbt.  You can of course rsync
with the system running, just kickoff all your users and login as
root (you'll need to be root to preserve permissions and have full
access anyway).  It may take longer using rsync than tar though.

root@foo# rsync -ar /mnt/home/ /mnt/backup/

All three ways (cp, tar, rsync) should do just about the same thing.
I'm not sure why cp says "preserve if possible", it should work fine.
(Meaning i've never had a problem with 'cp -a' not preserving
permissions.)

Tim

-- 

@a=(Lbzjoftt,Inqbujfodf,Hvcsjt); $b="Lbssz Wbmm"
;$b =~ y/b-z/a-z/ ; $c =" Tif ". @a ." hsfbu wj"
."suvft pg b qsphsbnnfs". ":\n";$c =~y/b-y/a-z/;
print"\n\n$c ";for($i=0;$i<@a; $i++) { $a[$i] =~
y/b-y/a-z/;if($a[$i]eq$a[-1]){print"and $a[$i]."
;}else{ print"$a[$i], ";}}print"\n\t\t--$b\n\n";



______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug