Solved

tar to mutiple files

Posted on 2012-04-05
3
624 Views
Last Modified: 2012-04-20
We have directory in solaris which has thousands of subdirectories and files.

We need to tar this directory and copy it over the WAN. Since this directory is quite big in size (around 600GB) we can't just create one tar file.
Is there a way to create mutiple tar files based on size, say 10GB each?

One approach could be to select a few files and directories and tar them one at a time but this could be error prone (as we could miss something) and requires lot of manual work.

Is there a command which enables to create tar files based on size (say 10GB each), so that as soon as 10Gb size is reached a new tar file is created and so on.
0
Comment
Question by:ank5
3 Comments
 
LVL 5

Accepted Solution

by:
Sjizzel earned 350 total points
ID: 37810219
I found this article:

Sometimes when you want to store your backup or any other large set of files online or want to share them someone else you need to find a way to compress and split the files into chunks of 100 or more Megabytes. I felt the need for this as well recently when I wanted to store my backups online and the online storage service had a cap of 100 MB per file. I found a really neat solution based on the tar command. Using this method I split my backup of about 1 GB into 10 chunks of 100 MB each with incremental filenames.

The 1 GB file I wanted to split was called dbbackup.db. Here’s the command I ran to create multiple tar files of 100 MB each out of it:

# tar -cf – dbbackup.db | split -b 100m – db_backup.tar

This command took a long time to run. Once it was done running I was left with ten files, 100 MB each named db_backup.taraa, db_backup.tarab, db_backup.tarac, and so on and so forth.

Now I can copy these files to my external storage or ship them with ease. To stitch the 1GB file back together all I need to do is to run the following command:

# cat db_backup.tara* | (tar x)

And voila, I get my original file again.


http://www.simplehelp.net/2009/05/25/how-to-create-a-multi-part-tar-file-with-linux/
0
 
LVL 6

Assisted Solution

by:torakeshb
torakeshb earned 75 total points
ID: 37810223
To create:

tar -cf - <path to tar> | split -b 1000m – test.tar

To extract

cat test.tara* | tar xvf
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 75 total points
ID: 37810480
I think you missed the - in your command

cat test.tara* | tar xvf -
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search for selected keywords and its values in multiple log files 11 54
cron job says it ran, no results 25 115
unix solaris snoop command 6 85
Linux hostname change 2 55
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

896 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

11 Experts available now in Live!

Get 1:1 Help Now