mercoledì 6 febbraio 2008

I tar, You tar , He ...

Da SunManagers (febbraio 2008) Thread Tar question Solaris 9
1. Never archive/backup (tar, cpio) anything by absolute path!
Always 'cd' and use the relative path. Example: you want to
backup /var you should do;
cd /
tar cvf /opt/NOME.tar ./var/* # Notice it is DOT-/var
This will give you an /opt/NOME.tar which you can extract from
anywhere. If you wanted to restore to your REAL /var, you use the
same method as above:
cd /
tar xvf /opt/NOME.tar
Which will extract to 'var' which is relative to / (here).
Of course, you can also:
cd /tmp
tar xvf /opt/NOME.tar
and extract to /tmp/var/...

2. I always prefer to use GNU tar (gtar) to create/extract tarballs.
(On my Solaris9 systems it is: /usr/sfw/bin/gtar)
By default, GNU tar will convert absolute paths to relative paths
(changes leading '/' to './'). gtar is probably not available in
boot -s environment where you have system mounted under /a;
however, IIRC tarballs created with gtar will extract with plain
old tar. You might experiment to verify that it works for you.

Hope this helps.
Hi,
Try this;

cd /var
tar clf - * | (cd /a; tar xpf -)

Nessun commento:

Visite