You are on page 1of 6

How to: HP-UX UNIX Backup and Recover Data to Tape Device

http://www.cyberciti.biz/faq/hpux-data-backup-restore-commands/

About
Forum
Low graphics
Shell Scripts
RSS/Feed

Linux FAQ / Howtos

Home > Faq > File system

How to: HP-UX UNIX Backup and Recover Data to


Tape Device
by Vivek Gite 12 comments
Q. One of my responsibilities is backing up UNIX server. How do I backup data under HP-UX
UNIX? How do I use mt, fbackup and frecover commands to perform full and incremental
backups?
A. HP-UX offers various commands just like any other UNIX system to backup file system,
data and applications such as
tar command
a] dump / restore command (HFS filesystem only)
b] vxdump / vxrestore (vxfs filesystem only)
c] cpio command
d] fbackup / frecover command
e] dd command
f] tar command
g] make_net_recovery or make_tape_recovery commands

HP-UX Tape device names


First device will have name such as /dev/rmt/0m, /dev/rmt/1m and so on.
1. Raw magnetic tape interface - /dev/rmt/*
2. Default tape interface - /dev/rmt/0mnb

HP-UX Tape - mt ~ manipulating program


mt command winds the tape in the requested direction (forward or backward), stopping after the specified count
EOF marks or records are passed. If count is not specified, one is assumed. Each EOF mark counts as one
record. When winding backwards, the tape always stops at the BOT marker, regardless of the number
remaining in count.See mt command man page for more information. For example, Rewind the tape associated
with the device file /dev/rmt/0mnb:
# mt -f /dev/rmt/0mnb rew

How do I backup data with fbackup command?


Backup /data directory to /dev/rmt/0m, enter:
# fbackup -i /data -I index.data -f /dev/rmt/0m

2010/5/20

10:32

How to: HP-UX UNIX Backup and Recover Data to Tape Device

http://www.cyberciti.biz/faq/hpux-data-backup-restore-commands/

Where,
-i /data : Backup /data directory. There is no limit on how many times the -i option can be specified i.e. -i
/data -i /home -i /path/to/something
-I index.data : index.data specifies the name of the on-line index file to be generated. It consists of one
line for each file backed up during the session. Each line contains the file size, the volume number on
which that file resides, and the file name. If the -I option is omitted, no index file is generated.
-f /dev/rmt/0m : Specify tape device name
-e /tmp : Exclude /tmp from backup
-g /var/adm/fbackupfiles/hporabox11.backup.list.txt : File that contains a list of files / dirs to be
included / excluded from the tape backup
-u : Update the database of past backups so that it contains the backup level, the time of the beginning
and end of the session, and the graph file used for this fbackup session. Only use this if you are using -g
/path/to/file option.
Using the normal tape location to do a full backup, insert a new tape and enter:
# fbackup -f /dev/rmt/0m -i -v
Using the normal tape location to do a full backup but exclude /tmp and /cdrom /nfs directories, insert a new
tape and enter:
# fbackup -f /dev/rmt/0m -i / -e /tmp -e /cdrom -e /nfs -v
You can also create a text file that contains a list of all files and directories to be included or excluded from the
backup. For example, backup full file system but exclude /tmp, /cdrom and /nfs, enet:
# cd /var/adm/fbackupfiles
# vi hporabox11.backup.list.txt
Append following list
i /
e /tmp
e /nfs
e /cdrom
Save and close the file. To backup enter,
# fbackup -f /dev/rmt/0m -g /var/adm/fbackupfiles/hporabox11.backup.list.txt -v

How do I perform full and incremental backups?


The -0-9 option used to specify backup level. This single-digit number is the backup level. Level 0 indicates a
full backup. Higher levels are generally used to perform incremental backups. When doing an incremental
backup of a particular graph at a particular level, the database of past backups is searched to find the date of
the most recent backup of the same graph that was done at a lower level. If no such entry is found, the
beginning of time is assumed. All files in the graph that have been modified since this date are backed.
First, perform full backup, enter:
# fbackup -f /dev/rmt/0m -u -0 -g /var/adm/fbackupfiles/hporabox11.backup.list.txt -v
To perform incremental backup, enter:
# fbackup -f /dev/rmt/0m -u -1 -g /var/adm/fbackupfiles/hporabox11.backup.list.txt -v

How do I view contents of an fbackup tape?


Type the following command:
# frecover -f /dev/rmt/0m -x -N -v

How do I backup data with frecover command?


To restore all files and directories from tape, enter:
# frecover -f /dev/rmt/0m -r -v
To restore selected files or directories use -i /path option. For example, just restore /home/vivek directory, enter:
# frecover -f /dev/rmt/0m -x -v -i /home/vivek
Where,
-r : Recovery all data from tape
-x : Extracted / recover selected files / dires only specified by -i option
-i /path/to/file : Recover only this file or directory
-v : Verbose output

2010/5/20

10:32

How to: HP-UX UNIX Backup and Recover Data to Tape Device

http://www.cyberciti.biz/faq/hpux-data-backup-restore-commands/

How do I verify tape backup?


The -N option (no recovery) prevent frecover from actually recovering any files onto disk, but read the backup as
if it was, in fact, recovering the data from the backup, producing the same output that it would on a normal
recovery. This option is useful for verifying backup media contents in terms of validity (block checksum errors
are reported), and contents (a listing of files can be produced by using the -N and -v options together). Note
that the listing of files produced with the -N and -v options requires the reading of the entire backup, but is
therefore a more accurate reflection of the backup's contents than the index stored at the beginning of the
backup (which was created at the start of the backup session, and is not changed during the course of the
backup).
# frecover -f /dev/rmt/0m -N

Further readings:
man pages - rmt, frecover, tar, fbackup, mt, tar
Featured Articles:
20 Linux System Monitoring Tools Every SysAdmin Should Know
My 10 UNIX Command Line Mistakes
10 Greatest Open Source Software Of 2009
Top 5 Email Client For Linux, Mac OS X, and Windows Users
Top 20 OpenSSH Server Best Security Practices
Top 10 Open Source Web-Based Project Management Software
Top 5 Linux Video Editor Software
Please help us make nixCraft better for you and other users by taking this survey.
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email
newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

Email FAQ to a friend


Download PDF version
Printable version
Comment RSS feed
Last Updated: 01/22/08

{ 12 comments read them below or add one }


1 Margie Ludlam February 2, 2008 at 11:29 pm
Hi again,
Also, can I back up from a remote location like my pc at home with the Linux/Unix servers elsewhere?
Margie
Reply
2 mukesh December 4, 2008 at 7:38 am
very good material provided by you on recovery & backup
Reply
3 mukesh December 4, 2008 at 7:45 am
Can i BACKUP ON TAPE DRIVE from remort server.
for Example.
tape drive attach with prod_db1 server.
but backup command run from prod_db2 and both server on same network, who possible.

2010/5/20

10:32

How to: HP-UX UNIX Backup and Recover Data to Tape Device

http://www.cyberciti.biz/faq/hpux-data-backup-restore-commands/

Reply
4 vivek December 4, 2008 at 8:13 am
Yes, you can backup on tape drive from remote server using ssh.
tar cvzf - /data | ssh root@prod_db1

`mt -f /dev/rmt/0mnb rew; cat > /dev/rmt/0m`

See this faq for more info.


Reply
5 Aditya Prashar February 4, 2009 at 5:58 am
Kudos to the author. Marvellous stuff. Easy to understand.
Reply
6 Suyog April 8, 2009 at 5:09 pm
This is very good material found to understand the commands.
Reply
7 Gustavo G April 14, 2009 at 4:22 pm
Can i see the % or progress while the backup is running
Reply
8 Vivek Gite June 15, 2009 at 11:16 pm
@Gustavo,
No
Reply
9 Mirza July 18, 2009 at 6:14 pm
Hi,
Nice document, can u please tell me I have backed my HP-UX 11i system by using
#fbackup -0f /dev/rmt/0mn -v -i /
now which command should i run to see the backed up files and the remaining size of my tape. Also can i
perform another backup on the same tape.
Regards,
Mirza
Reply
10 sunda October 30, 2009 at 10:32 am
hello,
i want to take the backup from tape drive .pla send how to take in hp-ux server
immediately
Thanks & Regards
Reply
11 mukesh November 12, 2009 at 7:03 am
How we take backup on tape when data already on tape & i want to append new data on existing data ?
Reply

2010/5/20

10:32

How to: HP-UX UNIX Backup and Recover Data to Tape Device

http://www.cyberciti.biz/faq/hpux-data-backup-restore-commands/

12 Ravindra Yeole March 7, 2010 at 7:37 am


I have tape having capacity of 800/1600 GB
If today I will take backup four directories naming a, b, c, d, using SAM on 0m tape device. Suppose total
size of backup will be 200 GB
Tomorrow I want to take backup of directory named c on same tape using SAM on 0m device.
What will happen? It will keep previous data and add data on tape or over write all data on tape?
I want to add data on same tape what will be the process pl suggest.
Reply
Leave a Comment
Name
E-mail
Website

Notify me of followup comments via e-mail

Tagged as: backup data, backup file, backup hp ux tape, backups, cpio, data directory, data index, dd command, device names, fbackup
command, frecover command, g path, hp ux, index data, index file, line index, list hp ux tape backup files, mt command, restore hp ux
tape, tape recovery, tar command, unix server, unix system, verify hp ux tape backup, volume number

Sign up for our daily email newsletter:

Zmanda.com

Ads by Google

Search

2010/5/20

10:32

How to: HP-UX UNIX Backup and Recover Data to Tape Device

http://www.cyberciti.biz/faq/hpux-data-backup-restore-commands/

Files & Folders Backup


Sync Home & Office PCs In 1 Step.
UI In 30 Languages. Download Now!
www.AllwaySync.com

Data Center Backup


Dramatic Cost Savings v Competition
Centrally Managed Enterprise Backup
novastor.com/novabackup-datacenter

Related FAQs
HP-UX: Boot Into Single User Mode
How can I restore a backup of a MySQL database?
RPM database location for backup purpose
Restore a backup of a MySQL Database Server
Backup CentOS or Redhat Directory Server Database (LDAP)

2006-2010 nixCraft. All rights reserved | Privacy Policy | Terms of Service


Advertise | Questions or Comments | Sitemap

2010/5/20

10:32

You might also like