Operating System - HP-UX
1753876 Members
7340 Online
108809 Solutions
New Discussion юеВ

Re: creating system backup with tape drive

 
SOLVED
Go to solution
Maciej Szewczykowski
Frequent Advisor

creating system backup with tape drive

hello everybody,
i've got a question which i think will be an easy one to answer for you.
i'd like to store backup folder on a tape drive. the folder contains several subfolders, the overal size of them exceeds 2 GB.
and now i've got a problem, since the file system supports files up to (roughly) 2 GB.
i would like to have my archives stored on a single tape. i've tried several commands, for example the following one:

tar cvfML 1048576 /dev/rmt/0mnb ./file-to-be-stored

where option M is supposed to create a multi volume archive of a length provided by parameter L (in this case: 1048576 KB), however it fails to, simply stopping having created first volume and asking for providing a name for another one. When a name is provided, it stops operation in the middle of a next volume.
i've tried also cpio, but the result was also poor. By the way, i use DDS3 tape.

to sum up: how to create a big archive of more than 2 GB in the easiest way? and - possibly - how to retrieve the files back to hard disk?

thank you in advance,

regards,

maciek

7 REPLIES 7
Steven E. Protter
Exalted Contributor
Solution

Re: creating system backup with tape drive

tar can be upgraded via patch to allow for files up to 8 GB.

http://www1.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHCO_28992&context=hpux:800:11:11

fbackup could be used for the backup and can handle larger files. frecover is used to recover files in that conttext.

tar tvf does a dest run showing you what files will be restored where

tar xvf actually extracts them.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Joel Girot
Trusted Contributor

Re: creating system backup with tape drive

fbackup / frecover is more efficient for large volume. here a adaptation of my scripts for full and incremental backup. Replace /dev/rmt/c6t1d0BEST by your tape device and the root folder in "echo "i /" > /tmp/fbackup_total" by your folder. A folder /var/adm/fbackupfiles must be created before fbackup (for file dates managed by fbackup for incrementals backup)

#! /usr/bin/ksh -x
# fullbackup - full backup
# ========================
echo "\nStart fullbackup $(date)"

echo "i /gv1/gvr/joel/" > /tmp/fbackup_total

# list of saved files
export Ifile=/tmp/fbackup_0_$(date +%y%m%d)_$(date +%H%M).lst
set +e
/usr/sbin/fbackup -f /dev/rmt/c0t1d0BEST -0 -u -g/tmp/fbackup_total -I$Ifile 1>/tmp/fbackup.msg 2>&1
code=$?
cat /tmp/fbackup.msg
set +x

# handle return code
if (( $code == 0 )) ; then
echo "\033&dJfbackup good ended\033&d@"
elif (( $code == 4 )) ; then
echo "\033&dFfbackup ended with warnings\033&d@"
else
echo "\033&dCfbackup error\033&d@"
echo "fbackup failed on $(hostname). see /tmp/fbackup.msg" | mail root
exit $code
fi

echo "End fullbackup $(date)"


#! /usr/bin/ksh -x
# partbackup - partial backup, changes since level 0.
# ===================================================
echo "\nStart partbackup $(date)"

echo "i /" > /tmp/fbackup_total

# list of saved files
export Ifile=/tmp/fbackup_1_$(date +%y%m%d)_$(date +%H%M).lst
set +e
/usr/sbin/fbackup -f /dev/rmt/c0t1d0BEST -1 -u -g/tmp/fbackup_total -I$Ifile 1>/tmp/fbackup.msg 2>&1
code=$?
cat /tmp/fbackup.msg
set +x

# handle return code
if (( $code == 0 )) ; then
echo "\033&dJfbackup good ended\033&d@"
elif (( $code == 4 )) ; then
echo "\033&dFfbackup ended with warnings\033&d@"
else
echo "\033&dCfbackup error\033&d@"
echo "fbackup failed on $(hostname). see /tmp/fbackup.msg" | mail root
exit $code
fi

echo "End partbackup $(date)"

Joel
Paul_481
Respected Contributor

Re: creating system backup with tape drive

Hi Maciek,

Use fbackup/frecover, it is much more efficent backup and recovery method.

#fbackup -v -f /dev/rmt/0mnb -i /file-to-be stored -I /tmp/outputfile.

To recover

#frecover -f /dev/rmt/0mnb -rv

man frecover and fbackup for details.

Regards,
Paul
Maciej Szewczykowski
Frequent Advisor

Re: creating system backup with tape drive

thank you a lot, guys!
that is exactly what i wanted to know!

with best regards,

Maciek
R.KrishnaKumar
Frequent Advisor

Re: creating system backup with tape drive

Hi Maciek,

U can see the following patch with enables above 2GB to be backed up.

Patch Name: PHCO_28992

Patch Description: s700_800 11.11 tar(1) cumulative patch

or

u can use the GNU tar utility.

regds..
Krishna
Eknath
Trusted Contributor

Re: creating system backup with tape drive

Hi maciek,

Try to backup your files with the help of sam. It uses fbackup and in case size exceeds the capacity of tape it will ask to mount next tape. Its very easy, try it out

Thanks
eknath
Cem Tugrul
Esteemed Contributor

Re: creating system backup with tape drive

Hi Maciek,

KBRC00000197 [This document may be viewed by customers]
[This document has been certified]
Example backup/recover commands for fbackup, cpio, tar
Document Information Table
Example backup/recover commands for fbackup, cpio, tar
DocId: KBRC00000197 Updated: 1/3/00 8:52:22 AM

PROBLEM

The most frequently used commands for fbackup, cpio, tar.

RESOLUTION

(This document assumes the user's device file is /dev/rmt/0m.)

FBACKUP/FRECOVER

Things to remember about fbackup:

* fbackup MUST rewind the tape before beginning the backup and after
completing.
* a tape created with fbackup is only recoverable with frecover.
* a file listed in the index file (from option -rvNf) is not guaranteed
to be on the tape; this simply means that fbackup intended to back the
file up when it began the backup session.

Command Description

fbackup -vf /dev/rmt/0m -i / full system backup

fbackup -vf /dev/rmt/0m -i specifically include file/directory
/etc/hosts preceded by -i

fbackup -vf /dev/rmt/0m -i specifically include multiple
/etc/hosts -i /usr files/directories preceded by -i

fbackup -vf /dev/rmt/0m -e specifically exclude file/directory
/etc/hosts preceded by -e

fbackup -vf /dev/rmt/0m -g
graph_file_name backup from a graph file

frecover -xvf /dev/rmt/0m restore entire tape to originating
directory structure

restore entire tape to originating
frecover -xovf /dev/rmt/0m directory structure and overwrite any
existing files

cd /tmp restore entire tape to /tmp
frecover -xXvf /dev/rmt/0m (originating directory structure will
not be overwritten)

frecover -vf /dev/rmt/0m -I verify backup and read the index file
/tmp/index from the tape into a file called
/tmp/index

fbackup -vf /dev/rmt/0m 2>&1 log what is backed up, along with any
|tee /tmp/backup.log errors that occur

frecover -rNv -f /dev/rmt/0m 2>
/tmp/listing list of what is really on the tape

frecover -V /tmp/volume_headers
-f /dev/rmt/0m show volume headers on the tape

CPIO

Things to remember about cpio:

* cpio is very particular about its options. If the options used to
restore aren't compatible with the options used to backup, it will
complain. Fortunately, the complaints are fairly self-explanatory.

Command Description

find /etc/hosts -print | cpio -ocx >
/dev/rmt/0m backup one file

cat /etc/hosts | cpio -ocx >
/dev/rmt/0m another way to backup one file

find . -print | cpio -ocx > backup all files in current
/dev/rmt/0m directory

cpio -ictv < /dev/rmt/0m verify what is on the tape

cpio -iudmcx < /dev/rmt/0m restore all files on tape

cpio -icvdxumB < /dev/rmt/0m
'file_name' restore one file

TAR

Things to remember about tar:

* tar is, for the most part, platform generic (ie: a tar tape created on
a SUN machine can usually be read by an HPUX machine). However, if the
platforms are far removed from each other (ie: SunOS 4.x and HPUX
11.0), then reading the tape may be impossible.

Command Description

tar cvf /dev/rmt/0m /etc/hosts backup one file

tar cvf /dev/rmt/0m (file1) (file2) backup file1 and file2

tar tvf /dev/rmt/0m verify contents of tape

tar xvf /dev/rmt/0m restore entire tape

tar xvf /dev/rmt/0m (file) restore one file

tar tf /dev/rmt/0m | grep swp | xargs restore all files that contain
tar xvf /dev/rmt/0m the string swp

ALT KEYWORDS

fbackup, cpio, tar, backup, restore, example, command, index

[Image]


Creating an Archive to a Remote Device

Contents
About this document
Tape blocksize
Setting up the .rhosts file
On the target machine
On the source machine
Archive commands
Backup by name
Backup by inode
cpio
tar
rdump
Moving a file system remotely

About this document
Some UNIX systems have the capability of referencing a remote tape device
as if it were local to the source system. Running AIX Systems cannot
"mount" a remote tape device locally; however, data can be sent to a
remote machine tape device using rsh.
This document describes how to archive files to a remote tape device.
Information in this document is valid for AIX Versions 3.2.5 through 4.x.
IMPORTANT NOTE: The dd command will not span tapes. Multiple tape archives
are not available via this procedure.

Tape blocksize
1. Decide on the appropriate tape device blocksize (bs). Recommended
values are as follows:
9trk or 1/4in = 512
8mm or 4mm = 1024

2. To check the current blocksize of the tape device, enter:
tctl -f /dev/rmt0 status

3. To change the tape device blocksize, enter:
chdev -l rmt0 -a block_size=

Replace with the value that you want to assign.

Setting up the .rhosts file
In order to create a remote archive, the system being archived (the source
machine) must have access to the system with the tape drive (the target
machine). The target system can be accessed using any of the defined users
on that system, but the following examples assume that both the local and
remote user is root. For further information on rsh and user
authentication, please see the rsh man page or InfoExplorer.
On the target machine
1. As root, using a favorite editor, create a file in the / (root)
directory called .rhosts that allows the source system access to the
target system.
2. To determine the name of the source machine to be added to the
file, run the following command:
host

is the IP address of the source system.
3. Add the following line to the file:
root

is the system name determined in step 2.
4. Save the file.
5. Change the permissions on the .rhosts file by entering:
chmod 600 .rhosts

On the source machine
1. Once the .rhosts file is set up on the target system, test to be
sure the source system has access. On the source system, as root, enter:
rsh

is the name of the target host. Shell access should be
granted; no login prompt asking for a username should appear.
2. Type exit to log out.

Archive commands
The following are examples of how to use AIX archive commands to a remote
tape drive. In these examples, represents the target tape device
blocksize, is the name of the target system, and /dev/rmt0 is
used as an example of the remote tape device. The parameter is used
where a directory or file name is needed. For more information, please see
each archive command's man page or InfoExplorer.
Backup by name
1. To remotely create a backup archive by name, enter:
find -print | backup -ivqf- | rsh \
"dd of=/dev/rmt0 bs= conv=sync"

2. To restore a backup archive by name created as in the preceding
example, enter:
rsh "dd if=/dev/rmt0 bs=" | restore \
-xvqdf-

Backup by inode
WARNING: The backup by inode documentation states that the source file
system must be unmounted before archiving. Even though it might sometimes
work without unmounting, such usage is not supported.
1. To remotely create a backup archive by inode, enter:
umount
backup -0 -uf- | rsh \
"dd of=/dev/rmt0 bs= conv=sync"

2. To restore a backup archive by inode created as in the preceding
example, enter:
rsh "dd if=/dev/rmt0 bs=" | restore \
-xvqf-

cpio
1. To remotely create an archive using cpio, enter:
find -print | cpio -ovcB | rsh \
"dd ibs=5120 obs= of=/dev/rmt0"

2. To restore a cpio archive created as in the preceding example,
enter:
rsh "dd if=/dev/rmt0 ibs= obs=5120" | \
cpio -icvdumB

tar
1. To remotely create an archive using tar, enter:
tar -cvdf- | rsh "dd of=/dev/rmt0
bs= conv=sync"

2. To restore a tar archive created as in the preceding example,
enter:
rsh "dd if=/dev/rmt0 bs=" | tar -xvpf-


rdump
At AIX Version 4.2 and subsequent versions, rdump includes the -L flag.
This flag specifies the length of the tape in bytes. For example, for a
2GB tape, use -L 2g.
At versions prior to AIX 4.2, rdump requires the use of the -s (tape
length) and -d (density) flags for devices other than 9-track tape.
Suggested values are:
Size/Type | Size used | -c option | -d flag | -s flag
------------- ----------- ----------- --------- ----------
1/4" tape
----------------------------------------------------------
QIC-120 | 120 mb | yes | 1250 | 8800
QIC-150 | 150 mb | yes | 1250 | 10600
QIC-525 | 525 mb | yes | 2000 | 22000
QIC-1000 | 1.2 gb |
----------------------------------------------------------
8mm tape
----------------------------------------------------------
2.3gb | 2.2 gb | no | 1280 | 158596
5.0gb | 4.9 gb | no | 1280 | 353240
7.0gb | 6.9 gb | no | 1280 | 497420
----------------------------------------------------------
4mm tape
----------------------------------------------------------
2.0gb | 1.9 gb | no | 1280 | 136972
4.0gb | 3.9 gb | no | 1280 | 281152

1. To remotely create an rdump tape, enter:
rdump -0 -u -s -d -f <> \


2. To restore an rdump tape created as above, enter:
cd /
rrestore -rqvf :/dev/rmt0


Moving a file system remotely
One of the easiest methods of moving an entire file system across a
network while preserving permissions, UIDs, and GIDs is to use the tar and
rsh commands. By invoking a tar command on the local system that writes
the created archive to STDOUT, and redirecting that archive output to
STDIN of an extracting tar command running on the remote system, no
temporary file is created.
From the source system, enter:
tar -cvf- | rsh "cd \
tar -xvf-"
Our greatest duty in this life is to help others. And please, if you can't