Operating System - HP-UX
1827293 Members
3346 Online
109717 Solutions
New Discussion

gtar for restoring filesystems

 
SOLVED
Go to solution
Chern Jian Leaw
Regular Advisor

gtar for restoring filesystems

HI,
I have the following filesystems archived into a single S-DLT tape:
/fs26/design1/replica1
/fs26/design2/archive_1
/fs26/design5/cluster/
/fs28/design1/archive_2
/fs29/rctl/circuits

I would like to restore these filesystems beginning with /fs26, /fs28 and /fs29 into /fs26/archive1, /fs28/archive1, /fs29/archive1 respectively.

All of these filesystems have been archived into a single tape.

Is there a way to extract the filesystems out simultaneously and restore these filesystems into the respective areas mentioned simultaneously?

The filesystems have been archived as follows:
# gtar -Scv --verify --files from=jf40322020007 --file=/dev/rmt1

If I were to restore using :
# cd /fs26/design1/replica1
# gtar -xvf --file=/dev/rmt1 /fs26/design1/replica1

I believe I would have to wait for each archived filesystem to complete its restoration process before proceeding to the next.

Also, could someone verify if the extraction and restoration command is correct?

If there is a more efficient way of extracting and restoring these files, can someone show me a script to do this?

Could someone please help me out?

Thanks.
9 REPLIES 9
RAC_1
Honored Contributor

Re: gtar for restoring filesystems

gtar -xvf --file=/dev/rmt1 /fs26/design1/replica1
is ok.

But you will have to to extract one by one or else put them in script.

Regards,
There is no substitute to HARDWORK
harry d brown jr
Honored Contributor

Re: gtar for restoring filesystems

Chern,

Yes you will have to run the command separately to restore /fs26 into /fs26/archive, /fs28 into /fs28/archive, ...

UNLESS you just restore them in another directory (where you have enough disk space) and just MOVE them to their respective directories.

cd /sometempdir
gtar -xvf --file=/dev/rmt1 /dir2restore /dir2restore /dir2restore ...
mv /sometempdir/dir2restore /fs26/archive1


live free or die
harry
Live Free or Die
Trond Haugen
Honored Contributor

Re: gtar for restoring filesystems

I don't know gtar but had it been tar you could have used pax.
I am a bit rusty on pax bu I belive something like this should work:
pax -r -s ',*design*,archive1/design,' -f /dev/rmt1

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
H.Merijn Brand (procura
Honored Contributor

Re: gtar for restoring filesystems

GNU tar has some valuable options to accomplish this:

--exclude=pattern
When performing operations, tar will skip files that match pattern.
@FIXME-xref{}.
--exclude-from=file

--files-from=file
-T file
tar will use the contents of file as a list of archive members or
files to operate on, in addition to those specified on the
command-line. @FIXME-xref{}.
Enjoy, Have FUN! H.Merijn
Chern Jian Leaw
Regular Advisor

Re: gtar for restoring filesystems

Anil,
By putting the command :
gtar -xvf --file=/dev/rmt1 /fs26/design1/replica1
into a script, do you mean I'd have to do the following in the script:

#cat tarScript.sh
#!/bin/sh
cd /fs26/archive1
gtar -xvf --file=/dev/rmt1 /fs26/design1/replica1
gtar -xvf -- file=/dev/rmt1 /fs26/design2/archive_1


... (the list goes on for /fs26

cd /fs28/archive1
gtar -xvf --file=/dev/rmt1 /fs28/design1/archive_2

cd /fs29/archive1
gtar -xvf --file=/dev/rmt1 /fs29/rctl/circuits

OR, can I do the following:
#cat tarScript.sh
#!/bin/sh
cd /fs26/archive1
gtar -xvf --file=/dev/rmt1 /fs26/design1/replica1
gtar -xvf -- file=/dev/rmt1 /fs26/design2/archive_1


... (the list goes on for /fs26
#tarScript.sh

#cat tarScript.sh
cd /fs28/archive1
gtar -xvf --file=/dev/rmt1 /fs28/design1/archive_2

#tarScript.sh

Meaning that I'm accessing different filesystems archived in the same single tape simultaneously. Is this possible??

Could you help me out?
Thanks.
RAC_1
Honored Contributor

Re: gtar for restoring filesystems

It is ok just take care to cd to respective directory and rewinding a tape after each gtar command to avoid any errors.
There is no substitute to HARDWORK
Chern Jian Leaw
Regular Advisor

Re: gtar for restoring filesystems

Procura,

Thanks for the reply.
However, based on your reply:
--exclude=pattern
When performing operations, tar will skip files that match pattern.
@FIXME-xref{}.
--exclude-from=file

--files-from=file
-T file
tar will use the contents of file as a list of archive members or
files to operate on, in addition to those specified on the
command-line. @FIXME-xref{}.

I tried including filesystems to be excluded in a file, i.e:
#cat exclude.txt
/fs28/design1/archive_2
/fs29/rctl/circuits

#cd /fs26/archive1
#gtar -xvf --exclude-from=exclude.txt --file=/dev/rmt1

It did not exclude the files which should have excluded when restoring /fs26 stuffs in /fs26/archive1.

Could you help me out?

Thanks.
H.Merijn Brand (procura
Honored Contributor
Solution

Re: gtar for restoring filesystems

--exclude-from is a list of *patterns*
I've not read any further, so I don't recall if you need .* or * to add to these lines

#cat exclude.txt
/fs28/design1/archive_2*
/fs29/rctl/circuits*
Enjoy, Have FUN! H.Merijn
Chern Jian Leaw
Regular Advisor

Re: gtar for restoring filesystems

Procura,

I was wondering if you tell me if I could do the following:

I thought of having scripts which would access the single tape and extract the all filesystems in it into their respective paths simultaneously during restoration?

#cat tarScript_1.sh
#!/bin/sh
cd /fs26/archive1
gtar -xvf --file=/dev/rmt1 /fs26/design1/replica1
gtar -xvf -- file=/dev/rmt1 /fs26/design2/archive_1

... (the list goes on for /fs26
#tarScript.sh

#cat tarScript_2.sh
cd /fs28/archive1
gtar -xvf --file=/dev/rmt1 /fs28/design1/archive_2
#tarScript.sh

Could you please help me out?

Thanks.
CJ