1837409 Members
3661 Online
110116 Solutions
New Discussion

file system

 
SOLVED
Go to solution
Ragni Singh
Super Advisor

file system

Please tell me how to tar up an entire file system. The I can scp it to another system and untar the whole thing there. Any help will be greatly appreciated and points will be given.
9 REPLIES 9
Jeff Schussele
Honored Contributor
Solution

Re: file system

Hi Sanman,

Simply cd to the TOP of that FS & issue the following:

#tar cvf /tmp/fsname.tar ./*.*

Note you must NOT create the tar file in the same FS - it MUST be outside the FS you are tarring. So care must be given as to where you tar to - make sure you have sufficient space. The FS you create the tar file in must support > 2Gb files IF the tar file will reach that size. The *.* is needed to tar files that contain "."s

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Arockia Jegan
Trusted Contributor

Re: file system

Use tar cvf

output file is the archive name. If u want to tar the entire file system replace the input files with the file system name.
Sachin Patel
Honored Contributor

Re: file system

Say you want to tar /data
#cd /
#tar cvf /dev/rmt/??? data/

And it will create tape with all home directorys.

then at another system.

#cd /
#tar xvf /dev/rmt/??? and it will put data directory there.

Sachin
Is photography a hobby or another way to spend $
Sandip Ghosh
Honored Contributor

Re: file system

I guess cpio would be better option for you to copy the file system from one server to other.

PUSH method
-----------
# (find -xdev|cpio -coax) | remsh "cd ;cpio -icdmuxla"

PULL method
-----------
# remsh "cd ;find -xdev | cpio -coax"|cpio -icdmuxla

Sandip
Good Luck!!!
S.K. Chan
Honored Contributor

Re: file system

Or across the network (you must setup .rhosts correctly).
On the source machine, run these ..

# cd /source_dir
# tar cvf - . | remsh target_machine '(cd /dest_dir; tar -xvf -)'
Sanjay_6
Honored Contributor

Re: file system

Hi Sanman,

Say you want to tar a filesystem mounted at /mount_point, try this,

cd /
tar cvf /dir1/file_name.tar mount_point

This will create an archive at /dir1 and the archive name will be file_name.tar . The archive will have everything under /mount_point without the leading edges, to restore it on the same system,

cd /
tar xvf /dir1/file_name.tar

Do a "man tar" for more help.

Hope this helps.

Regds
SHABU KHAN
Trusted Contributor

Re: file system

Sanman,

Since you have asked for the syntax of scp I assume you have ssh configured between the two boxes and root can ssh between these without password, in that case you don't need a tar ball you could do:

For example if you want everything under /apps to be copied over to the remote host and the remote host also has a similar file system (/apps) then

cd /apps (on current host)
scp -p -r * remotehost:/apps/

This should copy everything under /apps on current host over the network to remotehost. The status will be printed on stdout. (-p preservs all permissions and -r recursively copies all directories/subdirectories)

If you do not have ssh configured then I would use SK Chan's method (works well)
# cd /source_dir
# tar cvf - . | remsh target_machine '(cd /dest_dir; tar -xvf -)'

Hope this helps.

Thanks,
Shabu
V. V. Ravi Kumar_1
Respected Contributor

Re: file system

hi,

try this.

go to one step above the FS u want to tar. issue the following command

#tar cvf
of if u want to copy on to tape
#tar cvf /dev/rmt/0m

regds
ravi
Never Say No
Francois Bariselle_3
Regular Advisor

Re: file system

You can use fbackup command to backup all file system:

fbackup -0i / -f /dev/rmt/0mn

Frank
Fais la ...