Restoring File From UFSdump Backup

Here’s what we did today on one of our Solaris box that is worth mentioning on this cool super system administrator’s blog ‘o mine! (Don’t you find it cool that SysAds are so funny?!)

Anyhoo, today we re-jumpstarted a laboratory box because the ‘owner’ of it wants it back. Since we pretty much messed it up, I have to jumpstarted a fresh copy.

After installing returned the original /etc/shadow and /etc/passwd back from backup (had a backup file on the laptop).. but unfortunately, the /etc/shadow file is ‘null’.

Restoring File From UFSdump Backup

Here’s the procedure in restoring a particular file from ufs dump backup… Of course if you’re restoring from ufs backup you probably made a ufs backup in the first place, right? Right!

In this example, the files backup.examples and junk are restored from the pubs directory:

# cd /var/tmp
# ufsrestore if /dev/rmt/Ø
ufsrestore > ls
lost+found/ pubs/

ufsrestore > cd pubs
ufsrestore > ls
.Xauthority .login .profile backup.examples%
.Xdefaults .mtdeletelog .wastebasket/ core
.cshrc .openwin-init Junk/ dead.letter
.desksetdefaults .openwin-init.BAK backup.examples junk

ufsrestore > add backup.examples
ufsrestore > add junk
ufsrestore > setmodes
set owner/mode for ‘.’? [yn] n
ufsrestore > extract
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
set owner/mode for ‘.’? [yn] n
ufsrestore > quit
# ls -l
total 6
drwxrwxrwt 3 sys sys 512 Mar 11 1Ø:36 ./
drwxrwxr-x 18 root sys 512 Mar 1Ø 16:43 ../
drwxr-xr-x 2 pubs staff 512 Mar 11 1Ø:11 pubs/
# pwd
# cd pubs
# ls
./ ../ backup.examples junk

There you go!

Leave a Reply

Your email address will not be published. Required fields are marked *