Linux tape backup with mt and tar command


Linux tape backup

อ้างอิง http://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/

The default tape drive under Linux is /dev/st0 (first SCSI tape device name). You can read more about tape drives naming convention used under Linux here. Following paragraph summaries command you need to use control tape drive for backup/restore purpose.

Rewind tape drive:
# mt -f /dev/st0 rewind

Backup directory /www and /home with tar command (z - compressed):
# tar -czf /dev/st0 /www /home
ถ้าไม่ compress ใช้ -cvf

Find out what block you are at with mt command:
# mt -f /dev/st0 tell

Display list of files on tape drive:
# tar -tzf /dev/st0
ถ้าไม่ compress ใช้  -tvf

Restore /www directory:
# cd /
# mt -f /dev/st0 rewind
# tar -xzf /dev/st0 www
ถ้าไม่ compress ใช้ -xvf

Unload the tape:
# mt -f /dev/st0 offline

Display status information about the tape unit:
# mt -f /dev/st0 status

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.

See also:

คำสำคัญ (Tags): #linux tape backup
หมายเลขบันทึก: 104053เขียนเมื่อ 17 มิถุนายน 2007 15:31 น. ()แก้ไขเมื่อ 1 มิถุนายน 2012 03:44 น. ()สัญญาอนุญาต: จำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (1)

หากมีการตั้ง schedule ให้ backup แบบเดิม ๆ ทุกวัน จำเป็นต้องให้มัน erase tape หรือว่า rewind ก่อนคำสั่ง backup หรือไม่ครับ

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท