LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 04-22-2009, 02:50 PM   #1
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Rep: Reputation: 15
Arrow 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

Code:
tar -tzf /dev/st0
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
 
Old 04-22-2009, 03:59 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 23,657

Rep: Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172
/dev/st0 will automatically rewind the tape after the current task completes but /dev/nst0 does not.
 
Old 04-22-2009, 04:23 PM   #3
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
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 04:25 PM.
 
Old 04-22-2009, 04:48 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 23,657

Rep: Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172
AFAIK you need to manually calculate.
 
Old 04-22-2009, 04:59 PM   #5
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
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?
 
Old 04-22-2009, 06:10 PM   #6
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
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.
 
Old 04-23-2009, 03:33 PM   #7
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
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 03:36 PM.
 
Old 04-23-2009, 04:31 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 23,657

Rep: Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172
I do not think it is possible
http://www.fermit.org.uk/~awr/quickies/sun_l9_mtx.html
http://74.125.95.132/search?q=cache:...&ct=clnk&gl=us

Last edited by michaelk; 04-23-2009 at 04:47 PM. Reason: addition reference material
 
Old 04-23-2009, 07:44 PM   #9
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for the links Michaelk, I appreciate it.

What about the 800GB size? Is that the real usable size?
 
Old 04-23-2009, 07:47 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 23,657

Rep: Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172Reputation: 5172
Yes.
 
Old 04-23-2009, 09:25 PM   #11
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is Tar file to tape drive faster than dir/files to tape drive? Runge_Kutta Linux - General 2 03-11-2009 08:13 AM
Multiple Autologins; Multiple Users; Multiple Sessions mrclisdue Linux - Desktop 1 09-26-2007 06:50 AM
Multiple Sessions? ttague Linux - Newbie 4 01-02-2005 11:00 AM
Using the Multiple tape option with TAR bassman Programming 0 07-08-2004 01:49 PM
Multiple X sessions tw001_tw Slackware 9 05-31-2004 01:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration