Solved

Query regarding ufsrestore and ufsdumo command

Posted on 2004-10-28
914 Views
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
/usr:


ls command does not list the the contents of /usr

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

Please guide


Regards

sagar
0
Question by:sagar24
    15 Comments
     
    LVL 38

    Expert Comment

    by:yuzh
    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.

    0
     

    Author Comment

    by:sagar24
    Hi
    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

    Sagar
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    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
    index.
        eg:
                $ for fs in / /usr /var /export ; do
             /usr/sbin/ufsdump 0cf /dev/rmt/0n $fs
             done

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

         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.

         eg:
         /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.

       


    0
     

    Author Comment

    by:sagar24
    Hi

    If we conside
    EOF
     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


    Regards

    sagar
    0
     
    LVL 38

    Accepted Solution

    by:
    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.
    0
     

    Author Comment

    by:sagar24
    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 ..

    Regards

    Sagar
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    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.



     
    0
     

    Author Comment

    by:sagar24
    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..

    Regards

    Sagar Sirdesai
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    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.


    0
     

    Author Comment

    by:sagar24
    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
    now
    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..

    Regards
    Sagar



    0
     
    LVL 38

    Expert Comment

    by:yuzh
    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

    0
     

    Author Comment

    by:sagar24
    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.


    Regards

    Sagar Sirdesai
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    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

       or
       ufsrestore -xvf /dev/rmt/0n

       eg:
      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.

    0
     

    Author Comment

    by:sagar24
    Thanks A LOT YUZH..

    Regards

    Sagar Sirdesai
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    You are welcome!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
    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 …
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    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.

    913 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now