Sie sind auf Seite 1von 6

What We Do Custom Dev elopment For the Web Maintenance Testimonials Dev elopment Concepts Usability Metatags Anti-Virus

Anti-Spam Business Accounting Backup EDGE Digital Signage Linux Scalix Shop OnLine Document Management Applications Business Inf o Hardware Inf o Microsof t Inf o Linux 101 AIX 101 OnLine Help Help Desk Blog Backup EDGE Eudora my SQL PowerTerm uniBasic Business Pro & Y es I Can Analy ze Y our Needs Sof tware Ownership Password Creation Ef f ectiv e Presentations Buses Cables Chips DVD Memory Monitors Networks Power Protection RAID SCSI Versions & LIcenses About Of f ice Windows XP Access Excel Word

Set-up & Status General Commands Shell Commands Other Tips File Inf o Networking Printing Backup

Backup/Restore Commands
Relativ e v s Absolute Paths Backup or Restore compress, uncompress, pack, unpack, zcat cpio dd mksy sb restore tapechk tar tcopy tctl Backup f iles f rom/to a remote computer

Relative vs Absolute Paths


When restoring f iles backed up with the backup, cpio, or tar commands, find out FIRST whether RELATIVE or ABSOLUTE pathnames were used BEFORE the restore is initiated. We recommend using RELATIVE. Relative pathnames will hav e a ./ pre-f ixed to their path. These f iles will be restored relative to the current directory. Absolute pathnames won't hav e the ., just the /. These are restored with the f ull pathname to the exact directory as specif ied on the archiv e dev ice.

backup
Command ty pically used to backup f iles on an AIX platf orm. Distribution tapes f or AIX are in this f ormat. This command will span across multiple tapes. Backup by INODE is not recommended because it eliminates the capability to selectiv ely restore f iles by f ilename. If y ou hav e more data to backup than can f it on one tape, y ou will probably want to perf orm INCREMENTAL backups f or f iles that hav e been modif ied within the last 24 hours f or each day of the work week, f ollowed by making a complete backup of the sy stem on the weekend. The error message Volume on /dev /rf d0 is not in backup f ormat is generated when an attempt is made to extract a f ile NOT created by the backup command: If y our backup was successf ul, the last item logged by 'backup' is the time the backup f inished and the number of 512 by te block that were archiv ed. Example message of a successful backup: Backup finished on Sat Aug 1 15:22:34 CDT 1992; there are 8700 blocks on 1 volumes. Options -i Read standard input What it does

-v -f -e -q -p

List names of f iles being backed up Name of output dev ice (ty pically de/v /rmt0 f or tape driv e) Won't attempt to compress or pack f iles that are greater than 24 MB. Won't prompt user to insert tape Pack data. Backup images by def ault are NOT packed. If y ou wish to pack y our data, use this option. The restore command has enough intelligence to determine if a backup image is packed or not and take appropriate action Examples What it does Backup the f ile sy stem /u to tape dev ice using ABSOLUTE pathnames. Backup f iles and directories under current directory (.) using RELATIVE pathnames. The tee (|) will take as input the output of the backup command (f ilenames being copied) and write them to the log f ile 'BACKUP.LOG' f or later rev iew. Find any REGULAR f iles (-ty pe f ) that hav e been modif ied within the past 24 hours (-mtime -1) and write them to the tape dev ice but don't rewind (/dev /rmt*.1) the tape af ter backup has f inished. Backup f iles interactiv ely . Select the f ile(s) to backup by ty ping in the f ile's name. When done, press ^D to f inish. If there is more than one tape driv e attached to the sy stem, then y ou can specif y a range of dev ices to the -f f lag of the backup command. (/dev /rmt0-1)

find /u -print | backup -ivf/dev/rmt0 find . -print | backup -iepqvf/dev/rmt0 | tee /tmp/BACKUP.LOG find /faxdata -mtime -1 -type f -print | backup -ivf/dev/rmt0.1 backup -ivqf/dev/fd0 find / -print|backup -icvqf/dev /rmt0-1

top of page

compress, uncompress, pack, unpack, zcat


Utilities to compress or expand data. The compress command reduces the size of the named f ile(s) and renames it with a .Z extension. Compressed f iles can be restored to their original f orm using the uncompress command. This utility appears to hav e a more EFFICENT packing scheme than the PACK/UNPACK commands. Examples compress -v /tmp/junk uncompress /tmp/junk.Z What it does File /tmp/junk is compressed and gets renamed to /tmp/junk.Z. -v display s the percentage of f ile shrinkage Restores f ile to original f ile ty pe and f ile size and changes the name to /tmp/junk.

1)find . -print | backup -ivqpf The 3 commands will backup the current directory and compress that backup /tmp/roger.bck image to a f loppy diskette. 2) compress /tmp/roger.bck 3) find /tmp/roger.bck.Z -print | backup -ivqf/dev/fd0 1) restore -xvf/dev/fd0 2) uncompress < /tmp/roger.Z | restore -xvfzcat /tmp/junk.Z > /tmp/junk1 find /u/COMPANY -print | xargs pack -f find /u/COMPANY -print | xargs unpack top of page Restore the f iles archiv ed f rom a f loppy diskette. (In this example assume restored file=roger.Z) Uncompress the compressed image and restore this f ile back to the f ile sy stem Uncompresses /tmp/junk.Z into /tmp/junk1 Packs all the f iles under the specif ied directory (/u/COMPANY ) Unpacks all the f iles under the specif ied directory (u/COMPANY )

cpio
Copies f iles to/f rom an archiv e storage dev ice. This command is of ten used to copy f iles f rom UNIX to AIX sy stems. This command will span across multiple tapes. cpio stands for CoPy Input to Output. Options What it does

-c

Writes header inf ormation in ascii f ormat f or portability across UNIX sy stems. The message Out of phase--get help is generated when an attempt is made to extract a f ile not in cpio f ormat OR if the archiv e tape was written with the -c option. The cpio command doesn't hav e this option specif ied when attemping to extract f iles f rom the media (eg., cpio -icdumpv < /dev/rmt0) When restoring will prompt f or new path/f ile to restore to List the f ile name as it's being copied Read f rom standard input, i.e. key board Copies unconditionally . Older f ile replaces a newer one. Files with older modif ication times will replace f iles with newer modif ication times. Creates directories, if applicable For table of contents Perf orms block I/O in 512 by te blocks, if the block size of the dev ice that wrote the data on the tape was set to 512 by tes. Make sure y ou read with the same block size. If the block size that the data was written to and about to be read f rom are two dif f erent sizes, this message will be display ed: Cannot read from the specified device What it does

-r -v -i -u -d -t -C1

Examples

1) cd /u/roger Reads f ile names using the f ind command and copies to the f loppy driv e (/dev /f d0). 2) find . -print | cpio -ocv > /dev/fd0 find . -cpio /dev/fd0 Sav es f iles in current directory and writes this inf o to f loppy . Same command as abov e -print except much f aster. 1) cd /u/roger 2) cpio -icuvd < /dev/fd0 cpio -itvcC1 < /dev/rmt0 1) cd /u/roger 2) find . -print | cpio -dumpv /u/jerry find /u/roger -print | wcfind /u/jerry -print | wc cpio -imv /home/roger /.profile < /dev/fd0 cpio -i "*.f" "*.c" </dev/fd0 top of page Restore f iles and directories sav ed on the f loppy dev ice. These f iles are restored under the current directory (/u/roger) Only if relativ e pathnames (./<f ilename>) were used. List the table of contents f rom a tape dev ice. Copies all f iles FROM one directory TO another WITHOUT changing the permissions, owner/group or modif ication date of the f ile. Use the f ollowing command to v erif y that all f iles were copied: If the number of f iles encountered is the same f or both directories its saf e to assume that the directories are identical. NOTE: that the number of blocks allocated to the SOURCE directory (/u/roger) may be larger than the DESTINATION directory (/u/jerry ), since compaction of the directory structure will hav e occurred at the destination end. Selectiv ely restore the /home/roger/.prof ile f ile f rom f loppy

Selectiv ely restore only the *.f and *.c f iles f rom f loppy

dd
Conv erts/copies f iles to/f rom an output dev ice. DD stands for Data Dump. This command will NOT span across multiple tapes. Common utility f ound on most v ersions of UNIX. Examples dd if=/dev/rmt0 bs=512k | cpio -icdmv dd if=rs6000.data of=/dev /rmt0.4 bs=1024 conv=ebcdic What it does Reads the f iles of f the tape dev ice f aster because of the blocking f actor (bs=blocksize of 512K or cache upto 1/2 MB at a time) Copies the data f rom the input f ile (if =rs6000.dat) to the output tape dev ice (/dev /rmt0). The rmt*.4 dev ice extension means output is written in 1600 bpi f ormat. This creates an EBCDIC low density tape, resulting in a 1024 by te blocked non-labeled f ile. To extract this f ile on the AS/400, create a phy sical f ile with a record length of 1024 by tes. Use the CPY FRMTAP command to copy the f ile. NOTE: When copy ing data f rom an EBCDIC machine, make sure y our BLOCK SIZE is set to 0 on the tape dev ice

dd if=unixfile.txt of=DOSFILE.TXT conv=ucase tar -cvf- /u/roger | dd of=/dev/rmt0 bs=1024k

Copies the data f rom the input f ile (if =unixf ile.txt) to output name (of =DOSFILE.TXT) and conv erts the source data to UPPERCASE characters. Copies the ABSOLUTE path /u/roger using the tar utility . To speed this process up, these f iles are piped to the dd utility using a cache buf f er size of 1 MB.

dd if=/dev/rhdisk0 Copies the raw phy sical v olume named hdisk0 to the raw phy sical v olume named of=/dev/rhdisk1 bs=5120b hdisk1. This represents a copy disk utility . dd if=/dev/rmt0 of=/tmp /ascii_file conv=swab Copies the data f rom the tape dev ice (if =/dev /rmt0) and creates an output f ile (/tmp/ascii_f ile) - which is BY TE swapped (conv =swab) as it is being written out. This needs to be done if y our copy ing ascii f iles f rom a Sy stem V Unix machine (unisy s to the RS/6000) Usef ul when reading an ASCII f ile that is NOT delimited by a NL character.

dd if=/dev/rmt0.1 of=/tmp /data1 cbs=242 ibs=3240 conv=sync,unblock dd if=/dev/rmt0.1 of=/tmp /data1 cbs=147 ibs=2940 conv=ascii top of page

Will read a record size of 147 by tes, a block size of 2940 by tes, and conv ert the output to an ASCII f ile.

mksysb
High-lev el shell command f or backing up mounted f ile sy stems in the rootvg volume group. mkszfile -f must be called prior to mksy sb in order to create the /.fs.size f ile that mksy sb uses to determine which f iles will be backed up. 8MM TAPE DEVICE An 8mm tape driv e is the pref erred method of backing up y our sy stem because that tape can be used to recreate the rootv g image if one or more phy sical v olumes f ail. Each of the f ile sy stems MUST hav e at least 500 blocks f ree when the mksy sb backup is made. The sy stem will need some work space in each f ile sy stem when it is installing f rom a mksy sb backup. To utilize the f ull 2.3 gb tape capacity ... Set the blocksize to 1024 Edit the /usr/lpp/bosinst/diskette/startup2 f ile Change the f ollowing line f rom 512 to 1024. /etc/methods/chggen -a rmt0 -a block_size=1024 Create a new install/maint diskette MKSY SB can create a BOOTABLE tape. Further, the data is archiv ed in TAR f ormat. In order to look at the names of f iles backed up by this command, perf orm the f ollowing: tctl -f/dev/rmt1.1 fsf 3 tar -tvf/devrmt1.1 Example: mkszfile -f && mksysb /dev/rmt0 -f f orces extending the /usr or /tmp f ile sy stem if not enough working space (8 MB) exists. This command should ALWAY S succeed unless a tape has not been inserted into the archiv e dev ice (eg., rmt0), or the tape is either write-protected or has def ectiv e media. top of page

restore
Retriev e inf ormation f rom archiv e dev ice created with the backup command. Def ault dev ice is /dev /f d0. This command will read a backup image spread across multiple tapes. Examples restore -Tvf/dev/rmt0 What it does -T=table of contents, -v=list the f ile name being copied, -f=name of output dev ice. Will list the tape's table of contents. If y ou f orget to label the tape with the date that the tape was made, use this command to report back the date this archiv e was created.

restore -xvf/dev/rmt0 ./usr/tmp/My* restore -xdvf/dev/rmt0 ./usr/tmp restore -xvf/dev/rmt0 restore -xvf/dev/rmt0 ./tmp/TestFile 1) tctl -f/dev/rmt0 rewind 2) restore -s1 -Tvf/dev/rmt0.1 3) restore -s1 -Tvf/dev/rmt0.1 1) tctl -f/dev/rmt0.1 fsf 3 2) restore -xvqf/dev /rmt0.1 ./unix restbyname -xvqf/dev/fd0 -Z /tmp/DISK.LIST top of page

Restores all f iles that start with "My " f rom the /usr/tmp directory

Restores the directory named /usr/tmp f rom tape dev ice

Restores all the f iles located on the tape dev ice that were backed up using the backup command. -x=extract data f rom output dev ice. Restores only the f ile named ./tmp/TestFile f rom the tape dev ice. If the subdirectory /tmp doesn't exist in the current directory , then that subdirectory will be made prior to restoring 'TestFile'. 1. Rewind to the beginning of tape. 2. Rev iew f iles on FIRST backup image. 3. Rev iew f iles on SECOND backup image) Display s the table of contents f or multiple backup images. s1=specif ies that multiple backups are on the tape and that the restore command skips to the backup specif ied by the number associated with the 's' option. The 0.1 f or the output dev ice (-f f lag) means that once the tape has been read, it will not rewind. If only the second backup image was needed, could hav e just ty ped in: restore -s2 -Tv f /dev /rmt0.1 If by chance the ./unix f ile was deleted, go back to y our install tape and extract the f ile that needs to be restored. The f irst three images on the tape are BOSBOOT, INSTALL/MAINT, f ollowed by the TOC (table of contents) image. Selectiv ely restore ONLY those f iles listed in f ile /tmp/DISK.LIS

tapechk
Perf orms consistency checks on a tape dev ice. Primarily used to check tapes written in backup f ormat. Example: tapechk 2 ( Checks the f irst 2 f iles f ound on the tape dev ice.) top of page

tar
Probably the easiest command to use when transferring files from one UNIX system to another. This command will NOT span across multiple tapes. Tar stands f or Tape ARchiv er. When using this command while perf orming a SELECTIVE restore f rom a tape dev ice (eg;., tar -xv f /dev /rmt0 ./etc/motd), the tar command will continue to run until the end of tape is encountered, ev en af ter the f ile has been f ound. The error message tar: directory checksum error (0 != 12345) Tar is an older utility than cpio or backup/restore is generated when an attempt is made to extract a f ile that is NOT in tar f ormat. Options -c -x -v -f What it does Writes (creates) f iles (appends to archiv e dev ice) Extract (read) f iles f rom archiv e dev ice Verbose mode (display s names) Dev ice name to use Examples tar -cvf- * | dd of=/dev/rmt0 bs=128k dd if=/dev/rmt0 bs=128k | tar -xvftar -tvf/dev/rmt0 tar -cvf/dev/rmt0 /u/jones tar -xvf/dev/rmt0 tmp/newdata /tmp/olddata What it does Copies all the f iles and subdirectories f rom the current directory and pipes the output to the dd command f or f aster archiv ing. Use the dd command to read the tape dev ice f or f aster archiv ing and pipe the output to the tar command to restore the archiv ed f iles. List the table of contents of the tape dev ice. Copies the jones account to the archiv e dev ice named /dev /rmt0. Selectiv ely copies ONLY the newdata and olddata directories f rom the tape to the current directory .

tar -cvf- * | xargs compress -v > /tmp/tar.Z top of page

Copies all the f iles f rom the current directory and compresses them into the f ile named tar.Z.

tcopy
Copies f rom one magnetic tape device to another. This command will work f or copy ing multiple backup images f rom one media ty pe to another. It will continue to copy until two end-of -tape marks are encountered. Examples tcopy /dev/rmt0 tcopy /dev/rmt0 /dev/rmt1 What it does Display s ALL the backup images and their size f or the tape y our currently v iewing. Copies all the data f rom one media ty pe to another until two end of tape marks are encountered. In the example abov e, rmt0 could be a 8mm dev ice and rmt1 may be a 1/4" tape dev ice. If the error message: tcopy: Cannot open /dev/rmt?' is display ed, make sure the destination dev ice is not write-protected.

top of page

tctl
Command used to f ast f orward a tape dev ice (Tape ConTroL). Examples tctl -f/dev/rmt0 Rewind the tape dev ice. rewind tctl -f/dev /rmt0.1 fsf Mov e tape f orward to the second tape mark. The .1 on the rmt0 dev ice instructs the dev ice NOT to rewind af ter perf orming the command. Use this command to skip past unwanted tape images - assumming there are multiple archiv e images on the tape to skip past. What it does

tctl -f/dev/rmt0 Mov es the tape to the beginning, end, and back to the beginning again. Used to retension the retension tape when encountering multiple read errors on restore operations. top of page

Backup files from a remote computer


The local host MUST be included in remote's hosts /etc/hosts.equiv f ile. The local host and user name MUST be included in the $HOME/.rhosts f ile at the user account at the remote machine. Examples rsh lanai -l roger "dd if=/dev /rmt0" | tar -xvftar -cvf- * | rsh lanai -l roger "dd of=/dev/rmt0 bs=64k conv=block" tar -cvf- * | rexec lanai " dd of=/dev/fd0 bs=4096" top of page What it does Restores f iles FROM a remote tape driv e on a host named 'lanai' The tar command will write it's output to the rsh command which pipes the data to the remote host (lanai) and the tape driv e (/dev /rmt0). Specif y -l <UserName> if the local user is dif f erent f rom the remote user. Uses the f loppy driv e dev ice on node lanai to store f iles in tar f ormat.

Serv ices | Products | Support | About Us | Priv acy Policy | Legal Stuf f

Em ail us at Inf o@AHinc.com Advanced Horizons, Inc. All Rights Reserved

Das könnte Ihnen auch gefallen