Solved

Tar command  to span multiple TAR files

Posted on 2008-10-17
13
978 Views
Last Modified: 2013-12-02
HELP HELP HELP

I have a 60gig file and trying to back it up to a SAMBA share which has a 2gig max size allowance.   Idea is to TAR the files but need to know how to use the TAR command to be able to create multiple TAR files as it is backing up.

Is a pain because the SAMBA share only is able to take 2gig files but does anyone know how to use the TAR command to be able to zip up 60 gig of data but output the tar files in 2 gig chunks and name them apropriatly

Regards


Terry
0
Comment
Question by:ncomper
  • 5
  • 5
  • 3
13 Comments
 
LVL 16

Accepted Solution

by:
Bryan Butler earned 250 total points
Comment Utility
Use the -M with the tape-length options. The thing is the file need to be compressed already since you cannot use the -M option AND compression.
ex: $tar -c -M -L=200000 -f=tarfiel.tar <zipped file>.tgz
0
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
I don't think tar can split the backup the way you described. Why the file is so big?

you may try command like split

http://unixhelp.ed.ac.uk/CGI/man-cgi?split
0
 
LVL 5

Author Comment

by:ncomper
Comment Utility
I dont think that this works our problem is that we can only have 2 gig file sizes and need to the tar or command to automatically break the volume up into multiple file
0
 
LVL 16

Expert Comment

by:Bryan Butler
Comment Utility
I tried it and it works for me.  Are you getting an error?
0
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
You may use the the split command with the -b option where you specify the split size:

split -b 2000m
0
 
LVL 5

Author Comment

by:ncomper
Comment Utility
does that automatically name the splits or do you have to manually enter the split names ?

thanks
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
it can do it automatically and you may optionally specify the prefix. Please see the man page or the link provided.

0
 
LVL 5

Author Comment

by:ncomper
Comment Utility
Hi,

Had this comment back from the server guy is this correct ???

"The split command would be useful to chop up the tar file once created. However we needed to split the tar file up during creation."
0
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
Ok,

What I recommended is

Why do you need to tar the file itself. If the it is only that you want to back it up on a samba share, then split the file with split command. The split command will not remove the file you want to split. It will create new splits (files) in the dir or share. This way you have the splits on the share and the original file in its place.
0
 
LVL 5

Author Comment

by:ncomper
Comment Utility
Cool can you select a target drive of multiple files of all different sizes (over and under 2 gig) then select a tar destination for the mutliple tar files and then split.  Is this posssible what would the command look like.

Regards
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 250 total points
Comment Utility
Can you explain what is the need for using tar here ? If the need is only to take backup of this file to another dir (which is basically a samba share) then you need to put the splits on that share

e.g.

cd /sambashare

split -b 2000m /path/to/myfile myfile_

This will take you to the samba share dir then create splits of the file that have their names starting with myfile (e.g. myfile_aa myfile_ab ...)
0
 
LVL 16

Expert Comment

by:Bryan Butler
Comment Utility
Please let me know if my suggestion doesn't work.  If not, please let me know the error.
0
 
LVL 5

Author Closing Comment

by:ncomper
Comment Utility
Thankss to you both for your help
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now