Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-22-2009, 01:50 PM
|
#1
|
Member
Registered: May 2006
Distribution: CentOS 5
Posts: 47
Rep:
|
Using TAR to write multiple sessions to the same tape
Hello there everyone
I'm trying to write multiple sessions to the same tape but am only seeing the last write.
Ex:
Code:
tar -czf /dev/st0 /dir1
tar -czf /dev/st0 /dir2
tar -czf /dev/st0 /dir3
tar -czf /dev/st0 /dir4
And when I do
It only displays the contents of /dir4
I've googled a bit and found the following to be able to write multiple sessions:
Code:
tctl -f /dev/rmt0 rewind
tar cvf /dev/rmt0 filenametosave
tctl -f /dev/rmt0 rewind
tctl -f /dev/rmt0.1 fsf 1
tar cvf /dev/rmt0 filenametosave
tctl -f /dev/rmt0 rewind
tctl -f /dev/rmt0.1 fsf 2
tar cvf /dev/rmt0 filenametosave
Thing is, I don't have rmt0 in my /dev/, only st0 and nst0. Nor do I have a tctl executable. I use mt and mtx.
The tape box is a Dell PowerVault TL2000 that the previous system admin here setup to be accessed through another box.
Any input would be greatly appreciated.
Thank You
|
|
|
04-22-2009, 02:59 PM
|
#2
|
Moderator
Registered: Aug 2002
Posts: 26,752
|
/dev/st0 will automatically rewind the tape after the current task completes but /dev/nst0 does not.
|
|
|
04-22-2009, 03:23 PM
|
#3
|
Member
Registered: May 2006
Distribution: CentOS 5
Posts: 47
Original Poster
Rep:
|
Thank you michaelk, it seems to be working fine now with nst0 and using fsf 1 to navigate the tape before listing files.
Now, is there a way to list the size of the files on the tape?
Say I'm building a script, how could it tell how much space is left on the tape?
Code:
[root@leda Wojtek]# mt -f /dev/nst0 eod
[root@leda Wojtek]# mt -f /dev/nst0 tell
/dev/nst0: Input/output error
[root@leda Wojtek]# mt -f /dev/nst0 status
SCSI 2 tape drive:
File number=4, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x46 (no translation).
Soft error count since last status=0
General status bits on (9010000):
EOD ONLINE IM_REP_EN
It only tells me that there's 4 files but nothing else.
Any special command I can do? Or the only way is prior to backing up, calculate the total size of a backup, save it to a file, and everytime I'm backing up, add the totals to know how much was backed up and substract that from the total capacity of 1 tape?
Last edited by WojtekO; 04-22-2009 at 03:25 PM.
|
|
|
04-22-2009, 03:48 PM
|
#4
|
Moderator
Registered: Aug 2002
Posts: 26,752
|
AFAIK you need to manually calculate.
|
|
|
04-22-2009, 03:59 PM
|
#5
|
Member
Registered: May 2006
Distribution: CentOS 5
Posts: 47
Original Poster
Rep:
|
The only problem I see with this is that if I use the -z flag with tar, I'll calculate the uncompressed filesize, not exactly the size that what will be written to tape.
Anyone got any suggestions? besides not compressing the files?
|
|
|
04-22-2009, 05:10 PM
|
#6
|
Senior Member
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep: 
|
You can't ever really be sure. If you compress before writing to tape, and have the tape's hardware compression turned off, then you have a better idea. If you rely on the tape's hardware compression, then you have less of an idea.
Typically, backup software writes to tape until it gets an end of tape error. That's how it knows that the tape is full. Then the last thing that was written has to be written again to a new tape.
|
|
|
04-23-2009, 02:33 PM
|
#7
|
Member
Registered: May 2006
Distribution: CentOS 5
Posts: 47
Original Poster
Rep:
|
We won't be using hardware compression, so that should help.
I'm thinking of gziping every file that will be archived, total the size into a file and then tar that to tape without the -z flag.
I think that should give me a quite accurate size.
Now, another question came to my mind.
Is there a way to rename the tape as seen in mtx status?
Code:
[root@leda Sun]# mtx status
Storage Changer /dev/sg5:1 Drives, 24 Slots ( 1 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = 000001L4
Storage Element 1:Empty
Storage Element 2:Full :VolumeTag=000002L4
Storage Element 3:Full :VolumeTag=000003L4
Storage Element 4:Full :VolumeTag=000004L4
Storage Element 5:Full :VolumeTag=000005L4
Storage Element 6:Full :VolumeTag=000006L4
Storage Element 7:Full :VolumeTag=000007L4
Storage Element 8:Full :VolumeTag=000008L4
Storage Element 9:Full :VolumeTag=000009L4
Storage Element 10:Full :VolumeTag=000010L4
Storage Element 11:Empty
Storage Element 12:Empty
Storage Element 13:Empty
Storage Element 14:Empty
Storage Element 15:Empty
Storage Element 16:Empty
Storage Element 17:Empty
Storage Element 18:Empty
Storage Element 19:Empty
Storage Element 20:Empty
Storage Element 21:Empty
Storage Element 22:Empty
Storage Element 23:Empty
Storage Element 24 IMPORT/EXPORT:Empty
Like instead of of seeing 000002L4, it would display ProjectX-Tape2
And yet another question, does an LTO4 tape really hold 800GB of data or like a hard drive it contains less because it's formatted?
Thank You
Last edited by WojtekO; 04-23-2009 at 02:36 PM.
|
|
|
04-23-2009, 03:31 PM
|
#8
|
Moderator
Registered: Aug 2002
Posts: 26,752
|
Last edited by michaelk; 04-23-2009 at 03:47 PM.
Reason: addition reference material
|
|
|
04-23-2009, 06:44 PM
|
#9
|
Member
Registered: May 2006
Distribution: CentOS 5
Posts: 47
Original Poster
Rep:
|
Thanks for the links Michaelk, I appreciate it.
What about the 800GB size? Is that the real usable size?
|
|
|
04-23-2009, 06:47 PM
|
#10
|
Moderator
Registered: Aug 2002
Posts: 26,752
|
Yes.
|
|
|
04-23-2009, 08:25 PM
|
#11
|
Senior Member
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep: 
|
If you kept a separate file that was a table of barcodes with your project names, then you could write a perl script that takes the mtx output and fills in the project names. It wouldn't take too much effort, and, once done, you'd have it for repeated use.
As far as compression goes, I would compress, whether you choose hardware compression or gzip. You could get an estimate of how compressible your data is and then make a conservative guess at how much to put on the tapes. If you have a lot of data to backup, you shouldn't have to make do with less than the tape can hold (that is, settling for 800G, when it could perhaps hold half again or twice that depending on your data).
|
|
|
All times are GMT -5. The time now is 11:46 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|