Cpio backup on a tape

whenever i am trying to take a backup usign
$find . -depth | cpio -ov | gzip /dev/st0
it is giving me an error i.e.,
gzip stdout input/output error
i don't know how to resolve it??

Welcome!

Certainly gzip wants to compress the given filemame /dev/st0 to /dev/st0.gz
Try

find . -depth | cpio -ov | gzip > /dev/st0

Now gzip sees no filename and writes to stdout (that the shell has redirected to dev/st0).

1 Like

so like i have redirected the file to the particular file
for ex cd /home/admin/Example
Now i want to copy and compress the files in tape so i have typed this command
find . -depth | cpio -ov | gzip >/dev/st0
/dev/st0 is the address of the tape drive and i wan to copy all the file from that directory !
Accoridng to you what should be the correct commant??

Yes that should work.

BTW without the -depth the find (and an eventual restore) would be faster.

After the backup you can list the tape contents:

gunzip < /dev/st0 | cpio -ivdt

The last t is the -t (list) option for cpio.
Without the t it would restore to the current directory.

okay Thanks brother let me try those commands!

after i ran

find . -depth | cpio -ov | gzip > /dev/st0

it gives me this error
gzip: stdout: Input/output error

Then there is a problem with your tape drive.

What is your OS?
Find out with

uname -a
cat /etc/*release

Do you have the mt command?
Then try the following

mt -f /dev/st0 rewind
mt -f /dev/st0 status

my os is CentOS Linux 8.5.2111
yup and i have run mt commands nothing hppns
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x5e (no translation).
Soft error count since last status=0
General status bits on (41010000):
BOT ONLINE IM_REP_EN

Hmm, that looks good.
My only idea is that your tape drive requires a certain block size.
Consult its documentation!
gzip/gunzip are not aware of block sizes.
Try without compression and redirection:

find . | cpio -ov /dev/st0
find . | cpio --blocksize=0 -ov /dev/st0

blocksize=0 is what your mt status has reported.
Set it to 16 or 20 or 512 or whatever your documentation says.

I think you cannot use zip/gzip to write to a tape device as the output expected is a compressed file...

Have you tried MiG's proposal without gzip?

what id MiG's proposal ??

This one !
MadeInGermanyModerator of the Year

1

22h

Hmm, that looks good.
My only idea is that your tape drive requires a certain block size.
Consult its documentation!
gzip/gunzip are not aware of block sizes.
Try without compression and redirection:

find . | cpio -ov /dev/st0
find . | cpio --blocksize=0 -ov /dev/st0

blocksize=0 is what your mt status has reported.
Set it to 16 or 20 or 512 or whatever your documentation says.

1 Like

i am having a lto 8 tape 30tb what should be its blocksize??

@Anku , you need to get your specific tape drive documentation - name of the manufacturer, model number etc and see if there is any specific details relating to that.

Apart of this specific instance of having issues have you ever read/written to this device previously ?

NB: the more information /concise details you supply the better chance the team have of responding with relevantly cogent information .

tks

Another idea:
how did you load the tape?
Try

mt -f /dev/st0 load

And I found a link that describes your error message and suggests to download/install further software:
https://community.hpe.com/t5/storeever-tape-storage/hpe-storeever-lto8-ultrium-30750-with-oracle-linux-8-5-or-rocky/td-p/7166285
BTW they mention a block size 64k; for cpio this would be

find . | cpio --blocksize=128 -ov /dev/st0

Not working it is still showing me gzip : stdout: Input/Output error

okay the tape i am usign is an Ultrium 8
hewlett packard enterprise 30 TB but when ever i am usign backup command with compression it is throwing error i.e,
gzip : stdout : Input/output error
so i want to know how to take a compressed backup using cpio on a tape
Thanks

@Anku , thks, couple of things

  • have you tried @MadeInGermany suggestions, if not please do and report back ( show commands executed and any accompanying error messages emitted ( copy/paste only -no screen shots , thks ).

  • have you (successfully) used the device previously, if so was that to read/or write, give details, a 'yes' response is not sufficient .

  • any other users of this device?,if yes have you spoken with them wet your issues? Any sysadmins you could discuss the issue with ?

NB: as a matter of course, Always supply commands executed, errors recieved, declarations like 'not working' or 'it failed' are pretty useless whereas inputs and outputs usually convey pretty much all of the details required.