Edi Yanto (何 萬 新)

Various Backup and Restore Scripts

Posted by: Edi Yanto on: March 6, 2009

(1) mt

# mt -f /dev/rmt/0n status (to check status of backup device)

# mt -f /dev/rmt/0n eom (to move to the end of tape)

# mt -f /dev/rmt/0 rewind (to rewind)

# mt -f /dev/rmt/0n fsf [count] (to jump [count] files)

# mt -f /dev/rmt/0n bsf [count] (to forward [count] files)

# mt -f /dev/rmt/0n erase (to delete tape)

# mt -f /dev/rmt/0n offline (to eject)

(2) tar

# tar tvf /dev/rmt/0o   (to check the tape)

# tar xvf /dev/rmt/0   (to tar from tape to HD)

# tar cvf /dev/rmt/0 /etc/hosts   (to tar files and directory to tape)

/etc/host and ./inet/hosts are symbolic linked

# tar rvf /dev/rmt/0 group   (to replace at the end of tarfile)

# tar cvfb  -  20 files | rsh host dd of=/dev/rmt/0  obs=20b
(to backup to a drive in remote host)

# rsh -n host dd if=/dev/rmt/0 bs=20b |tar xvBfb – 20 files
(to backup to a drive in remote host)

(3) ufsdump

(3a) For single file system

# ufsdump 0ucf /dev/rmt/0n /dev/rdsk/c0t0d0s0   (for full dump)

(3b) ufsdump option

0      : full dump
1 – 9  : gradual backup based from /etc/dumpdate
u      : record at /etc/dumpdate
c      : Catridge, (for 1000BPI density and 126 blocking factor)
l      : Autoload of next tape when tape ends before dumping finished.
v      : verify
S      : calculate capacity.
f   dump_file     :  record file image to dump_file
w        : /etc/dumpdate¸ shows ufs system which is not dumped yet

# ufsdump 0Sf /dev/rmt/0 /dev/rdsk/c0t0d0s0
873689088

# 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

# 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

(3c) For multiple file systems into one tape

# ufsdump 0ucf /dev/rmt/0n /dev/rdsk/c0t0d0s0;ufsdump 0ucf \
/dev/rmt/0n /dev/rdsk/c0t0d0s7

(4) ufsrestore

(4a) Restoring Entire File System

# mount /dev/dsk/c0t0d0s7 /export/home

# cd /export/home

# mt -f /dev/rmt/0n fsf 1  (to move to next point)

# ufsrestore rvf /dev/rmt/0n

(4b)   ineractive restore

# cd  /var/tmp

# 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
.:

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
.:

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

(4c) To restore files

# ufsrestore xvf /dev/rmt/0 ./etc/passwd

(4d) To display the content of the tape

# ufsrestore tvf /dev/rmt/0

(5) cpio commands

# find . -print | cpio -ovcB > /dev/rmt/0
(to copy current directory to tape)
.
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

# cpio -ivcB array/DECstgwks/install/foobar < /dev/rmt/0
(to extract foobar from tape)
array/DECstgwks/install/space
8550 blocks

# find . -mtime -7 -print | cpio -ovcB > /dev/rmt/0n
(to copy files which was modified within the last seven days)
.
upgrade
upgrade/Agree.ps
upgrade/Announcement.ps
upgrade/Program.ps
upgrade/Refund.ps

# find . -name ‘file*’ -print | cpio -ovcB > file.list

# 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}

(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

2 Responses to "Various Backup and Restore Scripts"

Ini backup ke tape ya ?
Bagaimana deteksi tape device di linux

iya tu bakcup ke tape di Sun, mksd u deteksi kyk apa? cek statusnya? ada tape yg aktif ato tidak gt? di Linux gue sendiri sich blm coba..

Leave a Reply

RSS Syndication


Edi Yanto
Oracle Applications Technical Consultant
View Edi Yanto's profile on LinkedIn
Edi Yanto (何 萬 新) - Blogged Page Rank Check

My Certifications


  • Edi Yanto: Hi Ang, You can find the solution for this problem at http://www.ediyanto.co.cc/unable-to-view-excel-output-xml-publisher-from-concurrent-program-req
  • ang: xml view output to excel ORA-01403: no data found -------------------------------------------------------------- FRM-40735: WHEN-BUTTON-PRESSED
  • Edi Yanto: Hi Ricky, Have you try to set the security setting (Enable Automatic prompting for file download) for your internet/local/trusted sites zone at inter

RSS Edi Yanto (何万新)

  • Oracle Top-N Query October 2, 2009
    Using RANK function, with a faster execution plan (WINDOW SORT PUSHED RANK) SELECT Empno, Ename, Job, Mgr, Hiredate, Sal FROM (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal, RANK() OVER (ORDER BY SAL Desc) AS Emp_Rank FROM Emp) WHERE Emp_Rank
    Edi Yanto
  • Bersyukurlah… June 30, 2009
    AKU TAK SELALU MENDAPATKAN APA YANG KUSUKAI oleh karena itu AKU SELALU MENYUKAI APAPUN YANG AKU DAPATKAN. Kata-kata di atas merupakan wujud syukur. Syukur merupakan kualitas hati yang terpenting. Dengan bersyukur kita akan senantiasa diliputi rasa damai, tentram dan bahagia. Sebaliknya, perasaan tak bersyukur akan senantiasa membebani kita. Kita akan selalu […]
    Edi Yanto
  • Cinta Sejati June 30, 2009
    Kenapa kita menutup mata ketika kita tidur ? Kenapa kita menutup mata ketika kita menangis ? Kenapa kita menutup mata ketika kita membayangkan sesuatu ? Kenapa kita menutup mata ketika kita berciuman ? Hal hal yang terindah di dunia ini biasanya tidak terlihat Ada hal hal yang tidak ingin kita lepaskan dan ada orang orang yang tidak ingin kita tinggalkan Tap […]
    Edi Yanto
  • Nice Story June 8, 2009
    Share on Facebook
    Edi Yanto
  • 5 Tips Agar Tak Mudah Lelah June 2, 2009
    Sebagian orang mengeluhkan kondisi tubuhnya yang cepat capai atau lelah. Kebanyakan orang menilai hal itu diakibatkan kerja ekstra. Tetapi, sebenarnya hal itu dilatarbelakangi kebiasaan seseorang sehari-hari. Berikut lima tips yang dikutip VIVAnews dari WebMD, Sabtu 25 April 2009 agar kondisi tubuh Anda tidak mudah capai atau lelah. 1. Lapar atau tidak, sara […]
    Edi Yanto
  • Belajar dari Alphabet May 29, 2009
    A : AcceptTerimalah diri anda sebagaimana adanya. B : BelievePercayalah terhadap kemampuan anda untuk meraih apa yang anda inginkan dalam hidup. C : CarePedulilah pada kemampuan anda meraih apa yang anda inginkan dalam hidup. D : DirectArahkan pikiran pada hal-hal positif yang meningkatkan kepercayaan diri. E : EarnTerimalah penghargaan yang diberi orang lai […]
    Edi Yanto
  • How To Get the List of All Responsibilities Assigned To A User May 29, 2009
    Edi Yanto
  • Query To Find Multi-Org Is Enabled Or Not May 29, 2009
    SELECT DECODE (multi_org_flag, ‘Y’, ‘Multi-Org Enabled’, ‘Multi-Org Disabled’ ) FROM fnd_product_groups; Share on Facebook
    Edi Yanto
  • How To Find A Patch Is Applied For A Bug May 29, 2009
    Edi Yanto
  • Excel Limitations on Images in Oracle Apps May 23, 2009
    The Excel output can’t showing the image (even after you save and send to another person or open it at different notebook), but it is showing only small red color empty cross written ‘An Image’.  Why??? As many of you know or have noticed, our Excel output for all flavors of BIP/XMLP is not true binary [...]
    Edi Yanto

 

March 2009
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Visitors

Blog Stats

  • 27,872 hits

Users Online

web counter

Pages