Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Tar command  to span multiple TAR files

Posted on 2008-10-17
13
Medium Priority
?
1,032 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 1000 total points
ID: 22743838
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
ID: 22743883
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
ID: 22744699
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

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

Expert Comment

by:omarfarid
ID: 22754810
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
ID: 22759248
does that automatically name the splits or do you have to manually enter the split names ?

thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22764450
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
ID: 22765404
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
ID: 22765651
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
ID: 22765876
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 1000 total points
ID: 22768182
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
ID: 22769238
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
ID: 31507211
Thankss to you both for your help
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If, like me, you have a lot of Dell servers in the estate you manage this article should save you a little time. When attempting to login to iDrac on any server I would be presented with two errors. The first reads "Do you want to run this applicati…
Determining the an SCCM package name from the Package ID
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 21 hours left to enroll

581 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