Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Query regarding ufsrestore and ufsdumo command

Posted on 2004-10-28
Medium Priority
Last Modified: 2013-12-27
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


Question by:sagar24
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
LVL 38

Expert Comment

ID: 12431250
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.


Author Comment

ID: 12470054
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

LVL 38

Expert Comment

ID: 12470141
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.


Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 12480728

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


LVL 38

Accepted Solution

yuzh earned 400 total points
ID: 12480873
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.

Author Comment

ID: 12578134
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 ..


LVL 38

Expert Comment

ID: 12589712
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.


Author Comment

ID: 12601443
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
LVL 38

Expert Comment

ID: 12601685
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.


Author Comment

ID: 12611865
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..


LVL 38

Expert Comment

ID: 12611956
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


Author Comment

ID: 12662548
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
LVL 38

Expert Comment

ID: 12662669
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.


Author Comment

ID: 12693431
Thanks A LOT YUZH..


Sagar Sirdesai
LVL 38

Expert Comment

ID: 12693650
You are welcome!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question