1 / 12

Backup Techniques

Backup Techniques. Objectives to illustrate practical application of backup utilities Contents using dd, a direct device access command manipulating magnetic tapes getting best of cpio working with DOS format diskettes network backups Practical to use DOS utilities Summary.

teo
Download Presentation

Backup Techniques

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Backup Techniques • Objectives • to illustrate practical application of backup utilities • Contents • using dd, a direct device access command • manipulating magnetic tapes • getting best of cpio • working with DOS format diskettes • network backups • Practical • to use DOS utilities • Summary

  2. Direct Device Access • Use dd to access a device directly • Useful command parameters: of=file write to named file instead of stdout if=file read from named file instead of stdin bs=size specify block size (also ibs and obs) count=n copy just n records conv=ascii convert EBCDIC to ASCII conv=ebcdic convert ASCII to EBCDIC conv=ibm slightly different convert ASCII to EBCDIC conv=swab swap every pair of bytes (big endian - little endian) # dd if=/dev/nst0 of=/tmp/ibm.tape \ bs=4095 conv=ibm,swab

  3. Exercise - Copying a Disk • How would you copy any format floppy disk? • Checkout Linux support for msdos mimic commands man –k mtools mdir mcopy mformat # change disks #

  4. Using dd To Identify File Type • Imagine you are given a backup disk marked with file name but no information about command used to create it • you are asked to restore data from that backup • which utility will you use? • This is where dd comes into it: • This is much neater than trying each utility in turn to see if it works! # dd if=/dev/fd0 count=1 of=test1 read just one block from the device and store it in a file # file test1 test1: tar

  5. Tape Device Names • Tape devices are kept in /dev/ • device names are usually simple numbers • By default tapes rewind after writing • tapes are not rewound before use but after • device names ending or beginning in n will not rewind after use • None SVR4 systems use other conventions • SCSI tape devices begin with st and nst • Can be accessed in modes a, l, m for dencity • Tapes are managed by mt command # cd / # echo "Filesystem: /etc\nDate: `date`" | dd of=/dev/nst0 # find etc -print | cpio -ocv >/dev/st0 # dd if=/dev/nst0 # cpio -itvc </dev/st0

  6. Handling Tapes with mt • Manipulate magnetic tapes with the mt command • specify the tape device with -f • Useful command parameters recognised: rewind rewind to start of tape offline rewind and take offline (drive may eject tape) fsf n skip forward n files bsf n skip backwards n files eom skip to end of media status print tape unit status information tell tell where on tape # cd / # mt -f /dev/st0 rewind # echo "Filesystem: /etc\nDate: `date`" | dd of=/dev/st0 # find etc -print | cpio -ocv >/dev/st0 # mt -f /dev/st0 rewind # mt -f /dev/st0 fsf 1 # cpio -itvc </dev/nst0 # mt -f /dev/st0 offline

  7. Linux filesystem dump • Not Recommended! (linux kernel 2.4) • The dump and restore programs are Linux equivalents to the UNIX programs of the same name. As such, many system administrators with UNIX experience may feel that dump and restore are viable candidates for a good backup program under Linux. Unfortunately, the design of the Linux kernel has moved ahead of dump's design. # /sbin/dump -0u -f /dev/st0 /usr/src # restore –i rf /dev/st0

  8. Backup & Restore with tar • Most classic and secure of them all • Minus, cannot backup empty directories • Operate on filesystem level • Filelocking can prevent backup of files • Backup and restore with tar • Use crontab to schedule backups 14 15 * * 6 /bin/tar cvfz /home/usershare/school/text.tar.gz /home/ftp/pub/text/* • Incremental backups # tar cvf /dev/st0 /home # cd /mnt/restored; tar xvf /dev/st0

  9. Prepairing the Backup script • Create the backup script backup.cron file, touch /etc/cron.daily/backup.cron - write the script on previous page and save it as backup.cron • date +%d%b < /backups/last-full/myserver-full-date • chmod 755 /etc/cron.daily/backup.cron NOTE! When restoring backups it is nice to have back permissions, not only the files. tar xpf backup.tar Up to 38% of the backup tapes will fail! It takes as long time as the backup took to recover!

  10. Putting Them Together • Speed up backups and reduce storage using compression • use the Unix compress utility to reduce archive size • Use dd to work with larger tapes blocks • can also use the -C option to cpio (SVR4) • TAR is most popular backup method • Not all tape modes might be supported # find . -print | cpio -ocvB | \ compress | dd of=/dev/st0 bs=65536 # dd if=/dev/st0 bs=65536 | \ uncompress | cpio -itvcB

  11. Network Backups • Use the rsh or rexec commands to run the backups across the network • Use NFS or similar to mount network filesystems • data can be backed up from any filesystem including networked drives • If using network drives be careful about backing filesystems you don't want • use the -mount option to find to restrict the file search # find . -print | cpio -ocvB | rsh rosies dd of=/dev/st0 # rsh rosies dd if=/dev/st0 | cpio -itvcB # rsh mash4077 'find . -print | cpio -ocvB' | dd of=/dev/st0 # dd if=/dev/st0 | rsh mash4077 cpio -itvcB

  12. Summary • Use dd for direct device access • dd can be used to encompass and read any format backup • Tapes can be controlled with mt command • Unix support special commands for working with DOS format diskettes • Backup utilities can be used in conjunction with compress command to save storage • Using combination of rsh command and backup utilities we can perform backups over the network • Avoid dump and restore • Use TAR or CPIO • Use script for scheduling backups

More Related