16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Unix</strong> Administration<br />

/var<br />

linked to /usr contains all files that vary<br />

Backups<br />

- security in case of damage to disks, viruses<br />

- restore files accidentally lost/damaged<br />

! Principles of backup security<br />

- Files are worth far more than equipment in terms of man hours and irreplaceable resources<br />

- Full, partial & Incremental backups UNIX dump command provides multilevel backups (increments of<br />

increments).<br />

- Keep multiple versions of full backups. Don't just write over your last version. The system might fail and <strong>the</strong>n<br />

you have nothing !!!<br />

- Keep long term backups. Files may be lost/corrupted but not noticed for a long period. Recent backups are <strong>the</strong>n<br />

useless.<br />

- Keep a full backup in ano<strong>the</strong>r distant building. Fire insurance may restore <strong>the</strong> machine but not <strong>the</strong> files 11<br />

(Your boss will be grateful...).<br />

- Keep dump tapes in a safe cool environment, preferably <strong>the</strong> same room (i.e. temperature) as <strong>the</strong> tape drive (1/2<br />

hr to acclimatize tapes).<br />

! Backup considerations<br />

- Nonarchive (No Header File) - copies everything, external label on tape<br />

- Archive (Header File) - writes header first<br />

- Catalog (Online Data Base) - contents, dates, media name, locations<br />

Unmounting a disk for even a short period is expensive day or night, in terms of work hours lost and programs<br />

killed or maimed.<br />

! Tape Drive Devices<br />

/dev/rmt0 - rewinds when closed<br />

/dev/nrmt0 - won't rewind when closed<br />

<strong>Unix</strong> Backup Programs<br />

! dd program<br />

Easy to use dd to treat devices (disk partition, o<strong>the</strong>r tapes) as a file and copy it to tape. Hence useful for quick<br />

backups of filesystems. Using dd, only whole filesystems can be restored, not individual files.<br />

dd if = backup.tar of=/dev/rmt0 bs=20k<br />

! tar (Tape Archiver)<br />

Archives or restores a subtree of files. Cannot handle anything larger than <strong>the</strong> tape. Cannot allow multiple writes to<br />

tape.<br />

tar cvf /dev/rmt0 /usr/local /etc > backup.log<br />

tar xv /usr/local/bin<br />

! cpio<br />

Similar to tar, reads a list of file names from stdin to be copied to tape, cannot detect end of tape.<br />

ls /user/bill | cpio -oc > /dev/floppy<br />

find . -print } cpio -ocv > /dev/rmt0<br />

<strong>Unix</strong> "find" command can search for all files modified since a given date and hence be used <strong>with</strong> "cpio" for<br />

incremental backups. No rewind is permitted.<br />

find / -depth -print | cpio -odlmv > /dev/nrmt1<br />

find /etc -depth -print | cpio -odlmv > /dev/nrmt1<br />

# incremental/full backup each user directory separately<br />

:<br />

TYPE=$l<br />

case $TYPE in<br />

full)<br />

IN= ;;<br />

190

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!