From Wiki-UX.info

Wiki-UX / Backup Commands / How to use fbackup
Jump to: navigation, search

How to use fbackup

Abstract

This article is a quick reference on the usage of the fbackup and frecover backup commands on the HP-UX Operating Environment. A review of the latest HP-UX Reference Manuals is highly advisable for additional examples, syntax description and any relevant warnings or notifications.

Contents


Name

fbackup - selective back up files

Synopsis

/usr/sbin/fbackup -f device [-f device] ...  [-0-9] [-nsuvyAEl]
[-i path] [-e path] [-g graph] [-d path] [-I path] [-V path]
[-c config]
 
/usr/sbin/fbackup -f device [-f device] ...  [-R restart] [-nsuvyAEl]
[-d path] [-I path] [-V path] [-c config]
 
/usr/sbin/frecover -r [-hmosvyAFNOX] [-c config] [-f device] [-S skip]
[-E extarg]
 
/usr/sbin/frecover -R path [-f device]
 
/usr/sbin/frecover -x [-hmosvyAFNOX] [-c config] [-e path] [-f device]
[-g graph] [-i path] [-S skip] [-E extarg]
 
/usr/sbin/frecover -I path [-vy] [-f device] [-c config]
 
/usr/sbin/frecover -V path [-vy] [-f device] [-c config]

Writing an archive

The fbackup command can be used to write directly to a tape devices special file (/dev/rmt/#m) or a plain file depending on the parameter after the -f option.

# fbackup -0vi /tmp -f /var/tmp/archive.fbackup
fbackup(1004): session begins on Tue Jan  1 17:22:23 2008
fbackup(3024): writing volume 1 to the output file /var/tmp/archive.fbackup
    1: / 16
    2: /tmp 16
    3: /tmp/.AgentSockets 1
    4: /tmp/.AgentSockets/A 0
    5: /tmp/.kc.trace 1
    6: /tmp/.s.PGSQL.10864 0
    7: /tmp/.s.PGSQL.10864.lock 1
    8: /tmp/.s.PGSQL.50006 0
    9: /tmp/.s.PGSQL.50006.lock 1
   10: /tmp/1111io_listener.log 0
   11: /tmp/5991-5974.cdimage 34472
   12: /tmp/ACL.log 0
   13: /tmp/X11_newfonts.log 2
   14: /tmp/core 1840
   15: /tmp/dhcpvalidate 1
   16: /tmp/ign_configure 1
   17: /tmp/install.vars 3
   18: /tmp/ipv6agt.crashlog 0
   19: /tmp/kern-verify.17801 8
   20: /tmp/kern-verify.3285 8
   21: /tmp/llbdbase.dat 0
   22: /tmp/lost+found 1
   23: /tmp/man003006 74
   24: /tmp/man006071 15
   25: /tmp/man010501 29
   26: /tmp/man021907 8
   27: /tmp/man023686 12
   28: /tmp/mirror.dd 16
   29: /tmp/nbp.efi 0
   30: /tmp/ntlc.3375 19
   31: /tmp/portmap.file 2
   32: /tmp/primary.dd 16
   33: /tmp/reports 3
   34: /tmp/root.mail 332
   35: /tmp/rpcbind.file 8
   36: /tmp/sd_ipd_acl.2705 1
   37: /tmp/swlist 0
   38: /tmp/test 347
   39: /tmp/vg01.mapfile 1
   40: /tmp/void.psf 1
   41: /tmp/vxportal
fbackup(1005): run time: 1 seconds
fbackup(3055): total file blocks read for backup: 37256
fbackup(3056): total blocks written to output file /var/tmp/archive.fbackup: 37448

Listing the archive contents

# frecover -f /var/tmp/archive.fbackup -I /var/tmp/index.fbackup
 
# cat /var/tmp/index.fbackup
8192                   1 /
8192                   1 /tmp
96                     1 /tmp/.AgentSockets
0                      1 /tmp/.AgentSockets/A
229                    1 /tmp/.kc.trace
0                      1 /tmp/.s.PGSQL.10864
26                     1 /tmp/.s.PGSQL.10864.lock
0                      1 /tmp/.s.PGSQL.50006
27                     1 /tmp/.s.PGSQL.50006.lock
0                      1 /tmp/1111io_listener.log
17649664               1 /tmp/5991-5974.cdimage
0                      1 /tmp/ACL.log
808                    1 /tmp/X11_newfonts.log
941856                 1 /tmp/core
226                    1 /tmp/dhcpvalidate
96                     1 /tmp/ign_configure
1292                   1 /tmp/install.vars
0                      1 /tmp/ipv6agt.crashlog
3899                   1 /tmp/kern-verify.17801
4065                   1 /tmp/kern-verify.3285
0                      1 /tmp/llbdbase.dat
96                     1 /tmp/lost+found
37498                  1 /tmp/man003006
7352                   1 /tmp/man006071
14795                  1 /tmp/man010501
3685                   1 /tmp/man021907
6041                   1 /tmp/man023686
8192                   1 /tmp/mirror.dd
0                      1 /tmp/nbp.efi
9711                   1 /tmp/ntlc.3375
744                    1 /tmp/portmap.file
8192                   1 /tmp/primary.dd
1025                   1 /tmp/reports
169677                 1 /tmp/root.mail
3616                   1 /tmp/rpcbind.file
53                     1 /tmp/sd_ipd_acl.2705
0                      1 /tmp/swlist
177572                 1 /tmp/test
30                     1 /tmp/vg01.mapfile
34                     1 /tmp/void.psf
0                      1 /tmp/vxportal

Extracting archive contents

To extract the complete contents of the fbackup archive.

# frecover -r -f /var/tmp/archive.fbackup

To extract a single file or directory on the archive you may use the -i option or a graph file that lists the file(s) or directory(ies) that should be extracted.

# frecover -r -f /var/tmp/archive.fbackup -i ./tmp/core
# cat /tmp/extraction.graph
i ./tmp/core
# frecover -r -f /var/tmp/archive.fbackup -g /tmp/extraction.graph

Copying files

The fbackup and frecover commands can be piped together to support copying files across directories or mount points.

# mkdir /var/tmp/test
 
# cd /
 
# fbackup -0i ./tmp -f - | ( cd /var/tmp/test; frecover -rvf - )
fbackup(1004): session begins on Tue Jan  1 17:30:19 2008
fbackup(3024): writing volume 1 to the output file -
drwxrwxrwt      root    root    ./tmp
drwx------      root    root    ./tmp/.AgentSockets
srwx------      root    root    ./tmp/.AgentSockets/A
-rw-rw-rw-      root    sys     ./tmp/.kc.trace
srwxrwxrwx      sfmdb   users   ./tmp/.s.PGSQL.10864
-rw-------      sfmdb   users   ./tmp/.s.PGSQL.10864.lock
srwxrwxrwx      hpsmdb  users   ./tmp/.s.PGSQL.50006
-rw-------      hpsmdb  users   ./tmp/.s.PGSQL.50006.lock
-rw-------      root    sys     ./tmp/1111io_listener.log
-rw-rw-rw-      root    sys     ./tmp/5991-5974.cdimage
-rw-r--r--      root    sys     ./tmp/ACL.log
-rw-r--r--      root    sys     ./tmp/X11_newfonts.log
-rw-------      root    sys     ./tmp/core
-rw-r--r--      root    sys     ./tmp/dhcpvalidate
drwxr-xr-x      root    root    ./tmp/ign_configure
-r--r--r--      root    sys     ./tmp/install.vars
-rw-r--r--      root    root    ./tmp/ipv6agt.crashlog
-rw-r--r--      root    sys     ./tmp/kern-verify.17801
-rw-r--r--      root    sys     ./tmp/kern-verify.3285
-r--r--r--      root    root    ./tmp/llbdbase.dat
drwxr-xr-x      root    root    ./tmp/lost+found
-rw-------      root    sys     ./tmp/man003006
-rw-------      root    sys     ./tmp/man006071
-rw-------      root    sys     ./tmp/man010501
-rw-------      root    sys     ./tmp/man021907
-rw-------      root    sys     ./tmp/man023686
-rw-rw-rw-      root    sys     ./tmp/mirror.dd
-rw-r--r--      root    sys     ./tmp/nbp.efi
-rw-r--r--      root    sys     ./tmp/ntlc.3375
-rw-------      root    root    ./tmp/portmap.file
-rw-rw-rw-      root    sys     ./tmp/primary.dd
-rw-rw-rw-      root    sys     ./tmp/reports
-rw-rw-rw-      root    sys     ./tmp/root.mail
-rw-------      root    root    ./tmp/rpcbind.file
-rw-r--r--      root    sys     ./tmp/sd_ipd_acl.2705
-rw-r--r--      root    sys     ./tmp/swlist
-rw-rw-rw-      root    sys     ./tmp/test
fbackup(3055): total file blocks read for backup: 37256
fbackup(3056): total blocks written to output file -: 37448
-rw-rw-rw-      root    sys     ./tmp/vg01.mapfile
-rw-rw-rw-      root    sys     ./tmp/void.psf
crw-r--r--      root    sys     ./tmp/vxportal

Recovering archives from relative directories

To recover files stores using absolute paths (trailing /) use the -X option to extract the files relative to the current working directory (pwd).

# cd /var/tmp/test
 
# frecover -vxX -f /var/tmp/archive.fbackup
drwxrwxrwt      root    root    /tmp
drwx------      root    root    /tmp/.AgentSockets
srwx------      root    root    /tmp/.AgentSockets/A
-rw-rw-rw-      root    sys     /tmp/.kc.trace
srwxrwxrwx      sfmdb   users   /tmp/.s.PGSQL.10864
-rw-------      sfmdb   users   /tmp/.s.PGSQL.10864.lock
srwxrwxrwx      hpsmdb  users   /tmp/.s.PGSQL.50006
-rw-------      hpsmdb  users   /tmp/.s.PGSQL.50006.lock
-rw-------      root    sys     /tmp/1111io_listener.log
-rw-rw-rw-      root    sys     /tmp/5991-5974.cdimage
-rw-r--r--      root    sys     /tmp/ACL.log
-rw-r--r--      root    sys     /tmp/X11_newfonts.log
-rw-------      root    sys     /tmp/core
-rw-r--r--      root    sys     /tmp/dhcpvalidate
drwxr-xr-x      root    root    /tmp/ign_configure
-r--r--r--      root    sys     /tmp/install.vars
-rw-r--r--      root    root    /tmp/ipv6agt.crashlog
-rw-r--r--      root    sys     /tmp/kern-verify.17801
-rw-r--r--      root    sys     /tmp/kern-verify.3285
-r--r--r--      root    root    /tmp/llbdbase.dat
drwxr-xr-x      root    root    /tmp/lost+found
-rw-------      root    sys     /tmp/man003006
-rw-------      root    sys     /tmp/man006071
-rw-------      root    sys     /tmp/man010501
-rw-------      root    sys     /tmp/man021907
-rw-------      root    sys     /tmp/man023686
-rw-rw-rw-      root    sys     /tmp/mirror.dd
-rw-r--r--      root    sys     /tmp/nbp.efi
-rw-r--r--      root    sys     /tmp/ntlc.3375
-rw-------      root    root    /tmp/portmap.file
-rw-rw-rw-      root    sys     /tmp/primary.dd
-rw-rw-rw-      root    sys     /tmp/reports
-rw-rw-rw-      root    sys     /tmp/root.mail
-rw-------      root    root    /tmp/rpcbind.file
-rw-r--r--      root    sys     /tmp/sd_ipd_acl.2705
-rw-r--r--      root    sys     /tmp/swlist
-rw-rw-rw-      root    sys     /tmp/test
-rw-rw-rw-      root    sys     /tmp/vg01.mapfile
-rw-rw-rw-      root    sys     /tmp/void.psf
crw-r--r--      root    sys     /tmp/vxportal

Recovering fbackup header information

To recover the header information from a fbackup command, you can use the -V flag of the frecover and review the header archive.

# frecover -V /tmp/header.dat -f /tmp/archive.fbackup
 
# cat /tmp/header.dat
Magic Field:FBACKUP*LABEL
Machine Identification:9000/800
System Identification:HP-UX
Release Identification:B.11.31
Node Identification:delta
User Identification:root
Record Size:16384
Time:Tue May  6 16:04:22 2008
Media Use:0
Volume Number:1
Checkpoint Frequency:256
Fast Search Mark Frequency:200
Index Size:10239
Backup Identification Tag:8966 1210111462
Language:
# date
Tue May  6 16:06:15 MDT 2008

Using fbackup to backup a LVM splitted volume group</tt>

It is a very common task to take a snapshot backup of /dev/vg00 or any other volume group using the LVM lvsplit & lvmerge commands.

Graph File

# cat /mnt/backup/split_vg00.graph
i /lvol1b
i /lvol3b
i /lvol4b
i /lvol5b
i /lvol6b
i /lvol7b
i /lvol8b
i /lvol9b
#/usr/bin/sh
# History: This program was ported on 2008.01.01 from the fbackup to pax conversion
# modeled on a Virginia Militar Institute script. The script skips /dev/vg00/lvol2
# since this is the swap logical volume.
 
LOGFILE=/mnt/backup/logs/`date +"%0y%m%d.%R"`
GRAPH=/mnt/backup/split_vg00.graph
STOREMED=/mnt/backup/latest.fbackup
 
# STEP 1. Splitting the mirrors
 
for COUNT in 1 3 4 5 6 7 8 9
do
   /usr/sbin/lvsplit /dev/vg00/lvol$COUNT
done
 
# STEP 2. Check and mount the volumes
 
/sbin/fsck -F hfs /dev/vg00/rlvol1b
/sbin/mkdir /lvol1b
/sbin/mount -F hfs -o ro /dev/vg00/lvol1b /lvol1b
 
for COUNT in 3 4 5 6 7 8 9
do
   /sbin/fsck -F vxfs /dev/vg00/rlvol$COUNTb
   /sbin/mkdir /lvol${COUNT}|>b
   /usr/sbin/mount -F vxfs -o ro /dev/vg00/lvol$COUNTb /lvol$COUNTb
done
 
# STEP 3. Make backup to tape using fbackup
 
/usr/sbin/fbackup -0u -g $GRAPH -f $STOREMED -I $LOGFILE -f $STOREMED
 
# STEP 4. Unmount and remege the mirrors
 
for COUNT in 1 3 4 5 6 7 8 9 # lvol2 ommited
do
   fuser -k /dev/vg00/lvol$COUNTb # Ensure there are not running processes on the logical volume
   /sbin/umount /lvol$COUNTb
   /sbin/lvmerge /dev/vg00/lvol$COUNTb /dev/vg00/lvol$COUNT
   /usr/bin/rmdir /lvol$COUNTb
done
# History: This program was ported on 2008.01.01 from the fbackup to pax conversion
# modeled on a Virginia Militar Institute script. The script recovers the content
# of the backup in a temporary directory /tmp/tapetest with enough space to contain
# the full volume group.
 
GRAPH=/mnt/backup/split_vg00.graph
STOREMED=/mnt/backup/latest.fbackup
 
# Step 1. Clean the directory to start fresh
 
if [ -d /tmp/tapetest ]
   then rm -rf /tmp/tapetest/* ]
fi
 
if [ ! -d /tmp/tapetest ]
   then mkdir /tmp/tapetest ]
fi
 
# Step 2. Extract the select files / directories from a fbackup compatible graph file.
cd /tmp/tapetest
/sbin/frecover -xX -f $STOREMED

Reference

  • HP-UX reference - fbackup(1M) - HP-UX 11i Version 2: August 2003
  • HP-UX reference - frecover (1m) - HP-UX 11i Version 2: August 2003
  • HP-UX reference - pax(1m) - HP-UX 11i Version 3: February 2007

Authors

Editor

This page was last modified on 20 April 2011, at 19:29. This page has been accessed 6,882 times.