Wednesday, July 20, 2011

ใช้คำสั่ง linux ตรวจสอบ Tape Backup

อันเนื่องมาจากการดูแลเซิร์ฟเวอร์ Linux ของหน่วยงานราชการที่ใช้ Tape Backup สำหรับ admin อย่างเรา มีหน้าที่ตรวจสอบและทำรายงานว่า tape ยังทำงานได้ปกติสุขดีอยู่หรือไฉน....

ตรวจสอบสถานะของ Tape Backup

# mt -f /dev/st0 status

หมุนม้วนเทปกลับไปยังต้นม้วน

# mt -f /dev/st0 rewind

Backup ไดเรกทอรี /www และ /home ด้วยคำสั่ง

# tar -czf /dev/st0 /www /home

ถามเทปว่าตอนนี้กำลังอยู่ที่ block ไหน

# mt -f /dev/st0 tell

ขอดูไฟล์ต่าง ๆ ในมัวนเทปหน่อยซิ

# tar -tzf /dev/st0

Restore /www directory:
# cd /
# mt -f /dev/st0 rewind
# tar -xzf /dev/st0 www

Unload the tape:

# mt -f /dev/st0 offline

Erase the tape:

# mt -f /dev/st0 erase

You can go BACKWARD or FORWARD on tape with mt command itself:
(a) Go to end of data:
# mt -f /dev/nst0 eod(b)

Goto previous record:
# mt -f /dev/nst0 bsfm 1(c)

Forward record:
# mt -f /dev/nst0 fsf 1

Replace /dev/st0 with your actual tape drive name.

ลอกเขามาแหละครับที่นี่
http://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More