Query regarding ufsrestore and ufsdumo command

Hi Gurus

I am comparitively new to ufsdump  and ufsrestore command...

I used command ufsdump to backup / /usr filesystems.

#ufsdump 0f /dev/rmt/0n /
#ufsdump 0f /dev/rmt/0n /usr

The ufsdump was successfully completed..

But When I tried to list the contents of the tape.

#ufsrestore -i
ufsrestore>cd /usr
ufsrestore> ls

ls command does not list the the contents of /usr

Pls tell me why ls is not listing ne thing in /usr..

Please guide


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You are using tape no-rewind device, you need to use

mt -f /dev/rmt/0n rewind
to rewind the tape

then do:
 ufsrestore tvf /dev/rmt/0n

to verify what's on the tape.
you can also use:

mt -f /dev/rmt/0n fsf x

to forward the tape space over x count of EOF marks.

man mt
man ufsrestore
man ufsdump

to learn more details.

sagar24Author Commented:
Sorry for the delayed reply

I would kike to have a few more clarification

1) If my filesystem size is more than the tape capacity,in that case can i use two tapes
Then how do  i go about it...

2) If i have partially written tape ..Then if i wanted to append the tape .
then ca i use mt  rewind and then mt eom to reach the end od recorded meduim and not end of tape

1) yes
    It is better to work out the data size to ufsdump the filesytems to a tape, it will make
life easier for future restore. (there was an old ufsdump/restore bug in Solaris, might
case problem with multiple tape restore).

    If you dump multiple filesystems to a tape, please remember to write down the file
            $ for fs in / /usr /var /export ; do
         /usr/sbin/ufsdump 0cf /dev/rmt/0n $fs

     the tape EOF index (fsf) would be):
     0 -- /
     1 -- /usr
     2 -- /var
     3 -- /export

     2) If i have partially written tape ..Then if i wanted to append the tape .
     Since you are using no-rewind device /dev/rmt/0n

     You can sipmle run anothe ufsdump to append the data to the tape, you need to make  a note with your tape.

     /usr/sbin/ufsdump 0cf /dev/rmt/0n /
     dump the / filesystem to the tape

     /usr/sbin/ufsdump 0cf /dev/rmt/0n /usr
    append /usr filesystem to the tape

     use need to use "mt" command to move aroud with the tape.


Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

sagar24Author Commented:

If we conside
 0 -- /
     1 -- /usr
     2 -- /var
     3 -- /export
What will yeild from this two commands below.
#mt -f /dev/rmt/0 -fsf 1
#mt -f /dev/rmt/0n -fsf 1

Note : Actually difference between /dev/rmt/0 and /dev/rmt/0n is understood with ufsdump command  but i get confused with other  commansds ufsrestore and mt.

2)I had / and /usr filesystems dumped on the tape.
To appned a  dir Snv887 i used tar -cvf /dev/rmt/0n Snv887

The command was succesful
But now   tar -tvf /dev/rmt/0n and tar -tvf /dev/rmt/0 does not list anything..

Note : Iam increasing the points


1) do a "man mt" to learn more about the tape operation, or read my answer for your 2nd question to see if can help.

2) Since you are using no-rewind device /dev/rmt/0n, to see your tar backup, you do:
        mt -f /dev/rmt/0n rewind
         #to rewind the tape

        mt -f /dev/rmt/0n fsf 2
        # advanced 2 EOF (by pass / and /usr), then:
         tar -tvf /dev/rmt/0n

        You should be able to see your tar stuff.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sagar24Author Commented:
Hi yuzh

I am getting confused as I am using both ufsdump and ufsrestore..

1)I have dumped the / on  tape using command
ufsdump 0uf /dev/rmt/0n /

Now if use the commands

ufsdump 0uf /dev/rmt/0n rewind
ufsdump ouf /dev/rmt/0n /usr

Dows this operation overwrite previous written / filesystem..

2)Also what is use of the option c

Please answer this query ..


1) Please re-read all the  previous comments to see if it can help you to understand it.
(You need to learn how to read man page to play with *nix).

   "ufsdump 0uf /dev/rmt/0n rewind"
    Will try to dump dir/file "rewind" to a tape.

    Here's an example of /usr append to / in the tape:
     ufsdump 0cf /dev/rmt/0n /
     ufsdump 0cf /dev/rmt/0n /usr

    Here's an overwriten example:
     ufsdump 0cf /dev/rmt/0n /
     mt -f /dev/rmt/0n rewind
     ufsdump 0cf /dev/rmt/0n /usr

     Please keep in mind that tape is a sequential access device!

2) c - "man ufsdump"
     c         Cartridge.

sagar24Author Commented:
Hi yuzh

I agree that I am not good understanding the man pages..

So I am asking your valuable inputs..
So please do that..

One more thing i would like to ask

#mt -f /dev/rmt/0n eom
#mt -f /dev/rmt/0n stauts
gave me a output
drive type = 52
drive status = 0
sense key error = 0
residue count = 0
file number = 5
block number = 0
Which says I have 5 tape files written (or 5 EOF's).

Now I issued a command
#mt -f /dev/rmt/0n bsf 1

This should now give filenumber=4
But It gives file number=5

Please correct me..


Sagar Sirdesai
If you tape position is in the beggining of the tape, run
#mt -f /dev/rmt/0n bsf 1

will not help, it stay in the same position.

The easy way for you to play around with tape, is to maintain a log/index/note about
what you have written to the tape, eg, I use /etc/vfstab as a reference:
when I perform a full system backup I have:

fsf 0-5

  #device               device          mount           FS      fsck    mount   mount
  #to mount     to fsck         point           type    pass    at boot options
  #/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr                ufs     1       yes     -
x  fd   -       /dev/fd fd      -       no      -
x  /proc        -       /proc   proc    -       no      -
x  /dev/dsk/c0t0d0s3    -       -       swap    -       no      -
0  /dev/dsk/c0t0d0s0    /dev/rdsk/c0t0d0s0      /       ufs     1       no      -
1  /dev/dsk/c0t0d0s4    /dev/rdsk/c0t0d0s4      /usr    ufs     1       no      -
2  /dev/dsk/c0t0d0s1    /dev/rdsk/c0t0d0s1      /var    ufs     1       no      -
3  /dev/dsk/c0t0d0s7    /dev/rdsk/c0t0d0s7      /export ufs     2       yes     -
x  swap -       /tmp    tmpfs   -       yes     -

the fsf index tell me the location of each file system in the tape.

eg, if I want to restore /export, I would do:

mt -f /dev/rmt/0n rewind
mt -f /dev/rmt/0n fsf  3

alway rewind and then "fsf x", you shoud be ok.

sagar24Author Commented:
Hi yuzh,
Thanks for your inputs..

But here when I issue
# mt -f /dev/rmt/0n eom
#mt -f /dev/rmt/0n bsf 1
Should'nt it move 1 EOF backwards.

Your earlier made my things very easy ..
This is just  to add more to it..

2)With reference to Your example above
if I want to restore /export, I would do:

mt -f /dev/rmt/0n rewind
mt -f /dev/rmt/0n fsf  3
I issue
ufsrestore -rf /dev/rmt/0n /export

It will ask me for
Specify next volume #:
Do I specify as 3
Or will it not as only..

Sorry for these numerous questions..


2) You can do:

   cd /myrestore-dir
   mt -f /dev/rmt/0n rewind
   mt -f /dev/rmt/0n fsf  3
   ufsrestore -xvf /dev/rmt/0n
   PS: No /export as command arg

   If you just want to verify what's in the tape, not restore to the HD, you do:
     mt -f /dev/rmt/0n rewind
     mt -f /dev/rmt/0n fsf  3
      ufsrestore -tvf /dev/rmt/0n

  Try to remember the following commands:
  Dump a filesystem to tape:
  # ufsdump 0cf /dev/rmt/0n /dev/dsk/c0txd0sx

  Verify what's on the tape:
  # ufsrestore tvf /dev/rmt/0n

  Restore from tape
  # ufsrestore xvf /dev/rmt/0n

  Rewind the tape:
  # mt -f /dev/rmt/0n rewind

  Forward the tape:
  # mt -f /dev/rmt/0n fsf x

sagar24Author Commented:
Hi Yuzh
Thanks for your  inputs ..
One Last Clarification after I am sure to be good with ufsdump and ufsrestore.

I perform the following commands

#ufsdump -0uf /dev/rmt/0n /
#ufsdump -0uf /dev/rmt/0n /usr
#ufsdump -0uf /dev/rmt/0n /export.
#ufsdump -0uf /dev/rmt/0n /export1

Please ..tell me when to use the r ,R and x option .....
Also how does h option plays a role.


Sagar Sirdesai
man ufsrestore:

     r         Recursive. Restore  the  entire  contents  of  the
               media  into the current directory (which should be
               the top-level of the file system).  To  completely
               restore a file system, use this function letter to
               restore the level  0  dump,  and  again  for  each
               incremental  dump.  Although, this function letter
               is intended for  a complete restore onto  a  clear
               file system, if the file system contains files not
               on the media, they are preserved.

     R         Resume restoring. ufsrestore  requests a  particu-
               lar  volume  of  a  multi-volume set from which to
               resume a full restore (see the r  function  letter
               above).  This  allows  ufsrestore  to start from a
               checkpoint when it is interrupted in the middle of
               a full restore.

    h         Extract or list the actual directory, rather  than
               the   files  that  it  references.  This  prevents
               hierarchical restoration of complete subtrees from
               the tape.

    In most case, when you want to restore a filesystem from tape back to the HD, you
can safely do:
   cd /dir-to restore
   ufsrestore -rf /dev/rmt/0n

   ufsrestore -xvf /dev/rmt/0n

  if you want to restore /usr from tape to /dev/rdsk/c0t0d0s4, you do:
  boot up to single usr mode from CD or boot server
  newfs /dev/rdsk/c0t0d0s4      #get rid of everything in /dev/rdsk/c0t0d0s4    
  mount   /dev/rdsk/c0t0d0s4  /mnt
  mt -f /dev/rmt/0n rewind
  mt -f /dev/rmt/0n fsf  1
   cd /mnt
   ufsrestore -rf /dev/rmt/0n
   rm restoresymtable

    That's it.

sagar24Author Commented:
Thanks A LOT YUZH..


Sagar Sirdesai
You are welcome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.