Discussion:
Using tar to run backups onto a tape device using cygwin
srikant veeraraghavan
2012-10-18 14:45:21 UTC
Permalink
Hi,

I have been trying to write few backups using the tar command onto a tape
drive which is zoned to my Windows server.
The Carts have been loaded on the tapes on which I need to run the backup.
I found the tape Symbolic name from the Device manager tab. And this is the
command that I used.

tar -cf \\.\Tape0 /cygdrive/c/StratfordData

Where Tape0: is my tape drive.
/cygdrive/c/StratfordData is my source.
When I run this command I do not get any error message, but nothing is
written.




--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-tar-to-run-backups-onto-a-tape-device-using-cygwin-tp93659.html
Sent from the Cygwin list mailing list archive at Nabble.com.
marco atzeri
2012-10-18 14:58:40 UTC
Permalink
Post by srikant veeraraghavan
Hi,
I have been trying to write few backups using the tar command onto a tape
drive which is zoned to my Windows server.
The Carts have been loaded on the tapes on which I need to run the backup.
I found the tape Symbolic name from the Device manager tab. And this is the
command that I used.
tar -cf \\.\Tape0 /cygdrive/c/StratfordData
Where Tape0: is my tape drive.
/cygdrive/c/StratfordData is my source.
When I run this command I do not get any error message, but nothing is
written.
what about mt package ?

"This mt is designed to be used on Cygwin only. It knows about
the special tape information given only in the Cygwin case."
Eric Blake
2012-10-18 15:11:54 UTC
Permalink
Post by srikant veeraraghavan
Hi,
I have been trying to write few backups using the tar command onto a tape
drive which is zoned to my Windows server.
The Carts have been loaded on the tapes on which I need to run the backup.
I found the tape Symbolic name from the Device manager tab. And this is the
command that I used.
tar -cf \\.\Tape0 /cygdrive/c/StratfordData
Isn't that the same as:

tar -cf '\.Tape0' /cygdrive/c/StratfordData

Are you sure you are using backslash correctly in your command?
--
Eric Blake ***@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
srikant veeraraghavan
2012-10-18 16:20:36 UTC
Permalink
Hi Eric,

I have tried even the way you have mentioned the backslashes. And they too
seem to work properly. But again as I said Nothing is written onto the
cartridges loaded in the tapes...

I have run the same using a Linux host using the command:
tar -cf /dev/st0 /StratfordData/StratfordData/30GB_dataset/
and it worked fine. The problem perssts with the windows host.



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-tar-to-run-backups-onto-a-tape-device-using-cygwin-tp93659p93668.html
Sent from the Cygwin list mailing list archive at Nabble.com.
Corinna Vinschen
2012-10-18 15:57:23 UTC
Permalink
Post by srikant veeraraghavan
Hi,
I have been trying to write few backups using the tar command onto a tape
drive which is zoned to my Windows server.
The Carts have been loaded on the tapes on which I need to run the backup.
I found the tape Symbolic name from the Device manager tab. And this is the
command that I used.
tar -cf \\.\Tape0 /cygdrive/c/StratfordData
No, no, no. When in Rome, ...

Here's the important link to the User's Guide:
http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-posixdevices

Cygwin is a POSIX layer, as such it provides a POSIX view to the
supported devices. If you use native Windows device names, the
special POSIXy handling of the device won't kick in and you are on
your own. If you want the entire thing, use the POSIX device name.

Having said that, what you want is either /dev/st0 or /dev/nst0.
Note that st0 and nst0 have a different meaning!


Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
srikant veeraraghavan
2012-10-18 16:27:53 UTC
Permalink
Thanks Corinna,

I actually read similar posts from you here wherein you have mentioned to
put the device names as st0 or nst0, depending on the type.
I tried even this:
tar -cf /dev/tape1 /cygdrive/c/StratfordData/30GB_Dataset/
and also
tar -cf /dev/st0 /cygdrive/c/StratfordData/30GB_Dataset/

st0 is the first tape location. I assumed that if my symbolic Tape name
under device manager shows tape5 my st number would be st5. Is that right?
Unlike in Linux where I could check using the sg_map command.
I took st0 fo Tape0, st1 for Tape1 and so on...

But still after running the command when I check no data is been written. My
cartridges are not Write protected and am logged in as an Admin user in
cygwin.

Regards
Srikant



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-tar-to-run-backups-onto-a-tape-device-using-cygwin-tp93659p93671.html
Sent from the Cygwin list mailing list archive at Nabble.com.
Corinna Vinschen
2012-10-18 16:48:45 UTC
Permalink
Post by srikant veeraraghavan
Thanks Corinna,
I actually read similar posts from you here wherein you have mentioned to
put the device names as st0 or nst0, depending on the type.
tar -cf /dev/tape1 /cygdrive/c/StratfordData/30GB_Dataset/
Don't try arbitrary file names, read the User's Guide instead.
Post by srikant veeraraghavan
and also
tar -cf /dev/st0 /cygdrive/c/StratfordData/30GB_Dataset/
st0 is the first tape location. I assumed that if my symbolic Tape name
under device manager shows tape5 my st number would be st5. Is that right?
Yes.
Post by srikant veeraraghavan
Unlike in Linux where I could check using the sg_map command.
I took st0 fo Tape0, st1 for Tape1 and so on...
But still after running the command when I check no data is been written. My
So you wrote to /dev/st0? Or /dev/st5? Whatever, existing tape
drives will also be visible as character devices under /dev.

How did you check if anything has been written? Did the tape drive
show activity? Did tar take a long time to write? Did you mis-type
and create a file instead, perhaps?

Don't use tar in the first place. Use the mt command and see if your
drive is recognized. Play with mt commands and look if they work.
Cygwin's mt status command can show a bit more information than its
Linux counterpart if you use an additional number, as in:

$ mt -f /dev/nstX status 1

or

$ mt -f /dev/nstX status 2


Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
srikant veeraraghavan
2012-10-19 07:39:37 UTC
Permalink
Hi Corinna,

I was looking into the /dev and / folder... It has actually created
directories in the name of st0 and st1. For checking if anything was written
or not I checked it in the GUI. I am using a Virtual Tape system which
reflects the data written in the Carts. And I was unable to see it in the
gUI.
This is what I did now...

Inside the dev/ I was not able to get the list of my devices, st0,st1... So
I used the script create_devices.sh to create the same in the /dev/
directory.

After this I checked the status of the tapes using the mt command:
mt -f /dev/st0 status 3.
Yes using 3 helped me with moore detailed info...After the cartridges were
loaded I could see the size available to be written.

Then I used the
tar -cf /dev/st0 /cygdrive/c/StratfordData/

Now I am able to run the backups and could see it get written in the GUI. So
the /dev/ devicename not being created was the issue. Instead of writting in
the tape it created it inside the /dev directory.

Thanks Corinna for your help.



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-tar-to-run-backups-onto-a-tape-device-using-cygwin-tp93659p93685.html
Sent from the Cygwin list mailing list archive at Nabble.com.
Corinna Vinschen
2012-10-19 12:30:25 UTC
Permalink
Post by srikant veeraraghavan
Hi Corinna,
I was looking into the /dev and / folder... It has actually created
directories in the name of st0 and st1. For checking if anything was written
Directories? That should have been plain files.
Post by srikant veeraraghavan
or not I checked it in the GUI. I am using a Virtual Tape system which
reflects the data written in the Carts. And I was unable to see it in the
gUI.
This is what I did now...
Inside the dev/ I was not able to get the list of my devices, st0,st1... So
I used the script create_devices.sh to create the same in the /dev/
directory.
mt -f /dev/st0 status 3.
Yes using 3 helped me with moore detailed info...After the cartridges were
loaded I could see the size available to be written.
Then I used the
tar -cf /dev/st0 /cygdrive/c/StratfordData/
Now I am able to run the backups and could see it get written in the GUI. So
the /dev/ devicename not being created was the issue. Instead of writting in
the tape it created it inside the /dev directory.
Sorry, but this is really weird. The fact that a file /dev/st0 does not
exist does not mean that Cygwin won't provide them. The actual device
is kept virtually, internally inside Cygwin. The *visible* /dev/st0 or
/dev/nst0 entries are just for convenience and good looks, not because
they are necessary. There should have been no need at all to create the
files under /dev.

Also, since Cygwin 1.7.16 fills the /dev directory automagically, the
fact that there was no /dev/st0 means, you're either running an old
version of the Cygwin DLL, or at the time of writing there was in fact
no "Tape0" device in Windows, and your tape device was using another
tape number.

Assuming you're running Cygwin 1.7.16 (uname -a will tell), you should
be able to remove the /dev/stX and /dev/nstX devices (in Windows
Explorer!) and then, when looking in Cygwin again, an `ls -l /dev/*st*'
should show some tape devices.


Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
srikant veeraraghavan
2012-10-18 16:13:05 UTC
Permalink
Also,
I have tried using these...
tar -cf /dev/tape1 /cygdrive/c/StratfordData/30GB_Dataset/
tar -cf /TAPE0 /cygdrive/c/StratfordData/30GB_Dataset/

Not sure which one is right as all of them do not report any errors!



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-tar-to-run-backups-onto-a-tape-device-using-cygwin-tp93659p93667.html
Sent from the Cygwin list mailing list archive at Nabble.com.
Corinna Vinschen
2012-10-18 16:38:49 UTC
Permalink
Post by srikant veeraraghavan
Also,
I have tried using these...
tar -cf /dev/tape1 /cygdrive/c/StratfordData/30GB_Dataset/
tar -cf /TAPE0 /cygdrive/c/StratfordData/30GB_Dataset/
Not sure which one is right as all of them do not report any errors!
Sure they don't. The tar -cf command created files with these names.
Have a look into / and /dev and you'll see.


Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
Loading...