50. backup °ü·Ã ¸í·É¾î ¿ä¾à
1. mt ¸í·É¾î
blue# mt -f /dev/rmt/0 status -> backup deviceÀÇ »óŸ¦ Ç¥½Ã
HP JetStore 6000 C1533 tape drive:
sense key(0x6)= Unit Attention residual= 0 retries= 0
file no= 0 block no= 0
blue# mt -f /dev/rmt/0 status
HP JetStore 6000 C1533 tape drive:
sense key(0x13)= EOT residual= 0 retries= 0
file no= 1 block no= 0
blue# mt -f /dev/rmt/0n status
HP JetStore 6000 C1533 tape drive:
sense key(0x0)= No Additional Sense residual= 0 retries= 0
file no= 4 block no= 0
blue# mt -f /dev/rmt/0n eom -> tapeÀÇ ¸Ç³¡À¸·Î À̵¿
blue# mt -f /dev/rmt/0 rewind -> tape¸¦ Á¦ÀÏ Ã³À½À¸·Î µÇ°¨´Â´Ù.
blue# mt -f /dev/rmt/0n fsf [count] -> count °¹¼ö ¸¸Å ÈÀϵڷΠ°Ç³Ê ¶è´Ù.
blue# mt -f /dev/rmt/0n bsf [count] -> count °¹¼ö ¸¸Å ÈÀÏ ¾ÕÀ¸·Î °Ç³Ê ¶è´Ù.
blue# mt -f /dev/rmt/0 erase -> tapeÀÇ ¸ðµç ³»¿ëÀ» Áö¿î´Ù. tape³ª device¿¡ µû¶ó´Ù¸£³ª ½Ã°£ÀÌ ¸¹ÀÌ °É¸°´Ù.
blue# mt -f /dev/rmt/0 offline -> tape°¡ eject µÈ´Ù.
2. tar ¸í·É¾î
blue# tar tvf /dev/rmt/0 -> tapeÀÇ ³»¿ëÀ» È®ÀÎÇÔ
-rw-r--r-- 0/3 6434 1997³â 7¿ù 16ÀÏ 12:47 st.conf
blue# tar xvf /dev/rmt/0 -> tape¿¡ÀÖ´Â ³»¿ë¸¦ Hard disk·Î ³»¸²
x st.conf, 6434 bytes, 13 Å×ÀÌÇÁ ºí·°
blue# tar cvf /dev/rmt/0 /etc/hosts -> Hard disk¿¡ÀÖ´Â file À̳ª directory¸¦ tape·Î ¹ÞÀ½
/etc/hosts´Â ./inet/hosts¿Í ±âÈ£ ¸µÅ©µÊ
blue# tar tvf /dev/rmt/0
lrwxrwxrwx 0/0 12 1998³â 3¿ù 5ÀÏ 10:01 hosts ./inet/hosts·Î ½Éº¼¸¯ ¸µÅ©µÊ
-r--r--r-- 0/3 558 1998³â 4¿ù 16ÀÏ 19:15 passwd
-r-------- 0/3 333 1998³â 4¿ù 16ÀÏ 19:15 shadow
blue# tar rvf /dev/rmt/0 group -> replace, tarfileÀÇ ³¡¿¡ Ãß°¡ÇÑ´Ù.
a group 1 Å×ÀÌÇÁ ºí·°
blue# tar tvf /dev/rmt/0
lrwxrwxrwx 0/0 12 1998³â 3¿ù 5ÀÏ 10:01 hosts ./inet/hosts·Î ½Éº¼¸¯ ¸µÅ©µÊ
-r--r--r-- 0/3 558 1998³â 4¿ù 16ÀÏ 19:15 passwd
-r-------- 0/3 333 1998³â 4¿ù 16ÀÏ 19:15 shadow
-rw-r--r-- 0/3 295 1998³â 4¿ù 16ÀÏ 19:12 group
blue# tar cvfb - 20 files | rsh host dd of=/dev/rmt/0 obs=20b -> remote host¿¡ÀÖ´Â drive·Î backup ¹Þ±â
blue# rsh -n host dd if=/dev/rmt/0 bs=20b |tar xvBfb - 20 files -> remote host¿¡ÀÖ´Â drive·Î backup ³»¸®±â
3. ufsdump ¸í·É¾î
3.1 ÇÑ°³ÀÇ ÈÀÏ ½Ã½ºÅÛÀ» ¹ÞÀ»°æ¿ì
blue# ufsdump 0ucf /dev/rmt/0n /dev/rdsk/c0t0d0s0 -> full dump
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: 1998³â 4¿ù 29ÀÏ ¼ö¿äÀÏ ¿ÀÀü 11½Ã 03ºÐ 20ÃÊ
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t0d0s0 (blue:/) to /dev/rmt/0n.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 1703122 blocks (831.60MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: 63.88% done, finished in 0:05
DUMP: 1703014 blocks (831.55MB) on 1 volume at 793 KB/sec
DUMP: DUMP IS DONE
3.2 ufsdump option
0 - 9 : ´ýÇÁ·¹º§·Î "0"Àº full dump¸¦ ÀǹÌÇÏ°í "1 - 9"´Â Á¡ÁøÀûÀÎ ¹é¾÷À» ¸»ÇÑ´Ù. /etc/dumpdate¸¦ ±âÁØÀ¸·Î ¹é¾÷ÇÑ´Ù.
u : /etc/dumpdate¿¡ ±â·ÏÇÑ´Ù.
c : Catridge, À̿ɼÇÀº 1000BPI density ¿Í 126 blocking factor·Î ¸ÂÃá´Ù.
l : Autoload , dump°¡ ³¡³ª±âÀü¿¡ tapeÀÇ ³¡À» ¸¸³ª¸é ´ÙÀ½ Å×ÀÌÇÁ¸¦ loadÇÑ´Ù.
v : verify
S : ¿ë·®À» °è»êÇÑ´Ù. ½ÇÁ¦·Î ¹é¾÷¹ÞÁö´Â ¾Ê´Â´Ù.
f dump_file : ÈÀÏ À̹ÌÁö¸¦ dump_file¿¡ ±â·ÏÇÑ´Ù. dump_fileÀº /dev/rmt/0 ´ë½Å¿¡ fileÀÌ µÉ ¼öÀÖ´Ù. ¸¸¾à dump_fileÀÌ "-" À̶ó¸é Ç¥ÁØ Ãâ·ÂÀ¸·Î dumpµÈ´Ù. hostname:device Ç¥±â¹ýÀ¸·Î ¿ø°Ý½Ã½ºÅÛ¿¡ ÀÖ´Â ÀåÄ¡¸¦ »ç¿ëÇÒ ¼öµµÀÖ´Ù. ex) ufsdump 0ucf blue:/dev/rmt/0 /dev/rdsk/c0t0d0s0
w : /etc/dumpdate¸¦ ±âÁØÀ¸·Î °¡Àå ÃÖ±Ù¿¡ ¹é¾÷µÇÁö ¾ÊÀº /etc/vfstab³»ÀÇ ufs ÈÀÏ ½Ã½ºÅÛÀ» ¸ðµÎ Ãâ·ÂÇÑ´Ù.
blue# ufsdump 0Sf /dev/rmt/0 /dev/rdsk/c0t0d0s0
873689088
blue# ufsdump w
Dump these file systems:
/dev/rdsk/c0t0d0s0 ( /) Last dump: Level 0, Date Wed Apr 29 12:50
/dev/rdsk/c0t0d0s7 (/export/home) Last dump: Level 0, Date Sat May 2 12:57
/dev/rdsk/c0t1d0s0 ( ) Last dump: Level 0, Date Wed Apr 29 11:23
blue# cat dumpdates
/dev/rdsk/c0t0d0s0 0 Wed Apr 29 12:50:50 1998
/dev/rdsk/c0t0d0s7 0 Sat May 2 17:20:01 1998
/dev/rdsk/c0t1d0s0 0 Wed Apr 29 11:23:19 1998
Sample Dump Schedule
0 once a month 0 once a month
¿ù È ¼ö ¸ñ ±Ý Åä ¿ù È ¼ö ¸ñ ±Ý Åä
5 5 5 5 5 3 3 4 5 6 7 2
5 5 5 5 5 3 3 4 5 6 7 2
5 5 5 5 5 3 3 4 5 6 7 2
5 5 5 5 5 3 3 4 5 6 7 2
¿ù È ¼ö ¸ñ ±Ý Åä ¿ù È ¼ö ¸ñ ±Ý Åä
0 <--| 0 <---|
<--------| <----|
<--------------| <----|
<-------------------| <---|
<------------------------| <---|
<------------------------------| <--------------------------------|
3.3 ¿©·¯°³ÀÇ filesystemÀ» ÇϳªÀÇ Å×ÀÌÇÁ¿¡ ¹ÞÀ»°æ¿ì
blue# ufsdump 0ucf /dev/rmt/0n /dev/rdsk/c0t0d0s0;ufsdump 0ucf /dev/rmt/0n /dev/rdsk/c0t0d0s7
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: 1998³â 4¿ù 29ÀÏ ¼ö¿äÀÏ ¿ÀÀü 11½Ã 03ºÐ 20ÃÊ
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t0d0s0 (blue:/) to /dev/rmt/0n.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 1703122 blocks (831.60MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: 63.88% done, finished in 0:05
DUMP: 1703014 blocks (831.55MB) on 1 volume at 793 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on 1998³â 4¿ù 29ÀÏ ¼ö¿äÀÏ ¿ÀÀü 11½Ã 03ºÐ 20ÃÊ
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: 1998³â 4¿ù 29ÀÏ ¼ö¿äÀÏ ¿ÀÀü 11½Ã 21ºÐ 18ÃÊ
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t0d0s7 (blue:/export/home) to /dev/rmt/0n.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 303300 blocks (148.10MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: 303280 blocks (148.09MB) on 1 volume at 1269 KB/sec
DUMP: DUMP IS DONE
4. ufsrestore ¸í·É¾î
4.1 Restoring Entire File System
blue# mount /dev/dsk/c0t0d0s7 /export/home
blue# cd /export/home
blue# mt -f /dev/rmt/0n fsf 1 -> ´ÙÀ½ point·Î À̵¿
blue# ufsrestore rvf /dev/rmt/0n
Verify volume and initialize maps
Media block size is 126
Dump date: Sat May 02 12:57:43 1998
Dumped from: the epoch
Level 0 dump of /export/home on blue:/dev/dsk/c0t0d0s7
Label: none
Begin level 0 restore
Initialize symbol table.
Extract directories from tape
Calculate extraction list.
Warning: ./lost+found: File exists
Make node ./cyberguy
Make node ./dsw
Make node ./dsw/core
Make node ./crash
Make node ./crash/blue
Make node ./test
Extract new leaves.
Check pointing the restore
extract file ./.CPR
extract file ./dsw/core/unix.2
extract file ./dsw/core/vmcore.2
extract file ./dsw/core/threadlist.0
extract file ./dsw/core/threadlist.2
extract file ./crash/blue/vmcore.0
extract file ./crash/blue/unix.0
extract file ./crash/blue/bounds
extract file ./crash/blue/threadlist.0.org
extract file ./crash/blue/threadlist.0
Add links
Set directory mode, owner, and times.
Check the symbol table.
Check pointing the restore
blue# pwd
/export/home
blue# ls
crash dsw restoresymtable
cyberguy lost+found test
blue# rm restoresymtable
4.2 ineractive restore
blue# cd /var/tmp
blue# ufsrestore ivf /dev/rmt/0
Verify volume and initialize maps
Media block size is 126
Dump date: Mon May 11 14:33:16 1998
Dumped from: the epoch
Level 0 dump of /user on blue:/dev/dsk/c0t1d0s3
Label: none
Extract directories from tape
Initialize symbol table.
ufsrestore > ls
.:
2 *./ 2 *../ 3 lost+found/ 4 passwd
ufsrestore > cd lost+found
ufsrestore > cd /
ufsrestore > add passwd lost+found
ufsrestore > verbose
verbose mode off
ufsrestore > verbose
verbose mode on
ufsrestore> delete lost+found
ufsrestore > ls
.:
2 *./ 2 *../ 3 lost+found/ 4 *passwd
ufsrestore > extract
Extract requested files
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
extract file ./passwd
Add links
Set directory mode, owner, and times.
set owner/mode for '.'? [yn] n
ufsrestore > quit
4.3 restore files
# ufsrestore xvf /dev/rmt/0 ./etc/passwd
4.4 display the content of the tape
# ufsrestore tvf /dev/rmt/0
5. cpio commands
blue# find . -print | cpio -ovcB > /dev/rmt/0 -> Çöµð·ºÅ丮ÀÇ ³»¿ëÀ» tape·Î backup ¹Þ´Â´Ù.
.
upgrade
upgrade/Agree.ps
upgrade/Announcement.ps
upgrade/Program.ps
upgrade/Refund.ps
upgrade/URCFORM.ps
array
array/DECptscII
array/DECptscII/pkgmap
array/DECptscII/pkginfo
array/DECptscII/root
array/DECptscII/root/kernel
array/DECptscII/root/kernel/drv
array/DECptscII/root/kernel/drv/classes
array/DECptscII/root/kernel/drv/ptscII.52
array/DECptscII/root/kernel/drv/ptscII.53
array/DECptscII/install
array/DECptscII/install/copyright
array/DECptscII/install/postinstall
array/DECptscII/install/preremove
array/DECstgwks
array/DECstgwks/pkgmap
array/DECstgwks/pkginfo
array/DECstgwks/root
array/DECstgwks/root/$TRANSDIR
array/DECstgwks/root/$TRANSDIR/sd.conf
array/DECstgwks/root/$TRANSDIR/trans.Z
array/DECstgwks/root/$TRANSDIR/trans.conf
blue# cpio -ivcB array/DECstgwks/install/space < /dev/rmt/0 -> tape¿¡¼ space fileÀ» extractÇÑ´Ù.
array/DECstgwks/install/space
8550 blocks
blue# find . -mtime -7 -print | cpio -ovcB > /dev/rmt/0n -> ÃÖ±Ù ÀÏÁÖÀϳ»¿¡ ¼öÁ¤µÈ fileÀ» tape·Î ¹Þ´Â´Ù.
.
upgrade
upgrade/Agree.ps
upgrade/Announcement.ps
upgrade/Program.ps
upgrade/Refund.ps
blue# find . -name 'file*' -print | cpio -ovcB > file.list
blue# cpio -ivt < file.list
6. Backup script sample
#!/bin/csh
set verbose
set day = `date +%y%m%d`
mt -f /dev/rmt/0n rew
ufsdump 0uf /dev/rmt/0bn /
ufsdump 0uf /dev/rmt/0bn /usr
ufsdump 0uf /dev/rmt/0bn /var
ufsdump 0uf /dev/rmt/0bn /export/home
ufsdump 0uf /dev/rmt/0bn /opt
echo "now test the backups."
mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 1 > /export/home/bert/dumpfile1.${day}
mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 2 > /export/home/bert/dumpfile2.${day}
mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 3 > /export/home/bert/dumpfile3.${day}
mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 4 > /export/home/bert/dumpfile4.${day}
mt -f /dev/rmt/0n rew;ufsrestore tfs /dev/rmt/0n 5 > /export/home/bert/dumpfile5.${day}
7. Sun O/S backup parameter
High density Fujitsu/Xylogics 1/2" tape
# dump 0uf /dev/rmt8 /dev/rxy0
600' QIC-24 9 track 1/4" cartridge tape
# dump 0ucf /dev/nrst8 /dev/rds0h
QIC-150 18 track 1/4" catridge tape:
# dump 0ucsf 1500 /dev/rst0 /dev/rsd0h
Exabyte 8mm catridge tape:
# dump 0usf 145000 /dev/rst0 /dev/rid001h
´ë»ó O/S : Solaris 2.x , Sun O/S
|