Maintaining File Systems
Only Run fsck on unmounted file systems.
Every time system boots, fsck performs a file system consistency check.
If file system is mounted with logging then fsck does not run at system boot.
UFS with system flag's of "clean," "stable," or "logging," are not checked.
fsck makes several scans through the file system.
Files and directories unreferenced yet allocated are put into lost+found directory.
Superblock consistency involves file system size, free block count, and free inode count.
Data block consistency involves...
Inode consistency involves...
Cylinder group block consistency involves unallocated data blocks claimed by inodes, unallocated data block count, and unallocated inode count.
Phases of fsck
fsck runs through each file system listed in /etc/vfstab file.
Phase 1 - Check blocks and sizes - check inode for inconsistencies.
Phase 2 - Check pathnames - checks directory inode inconsistencies.
Phase 3 - Check connectivity - checks all directories connected to file system.
Phase 4 - Check reference counts - compares link count info from Phases 2 & 3 then corrects discrepancies.
Phase 5 - Check cylinder groups - checks free blocks & used inode maps for consistency.
Example:
# fsck /dev/rdsk/c0t0d0s6
The output will show you the progress of each phase.
Two modes: Non-Interactive a& Interactive
Non-Interactive mode occurs during boot time, often referred to as preen or silent mode. Minor inconsistencies are fixed. Major problems cause fsck to terminate and leaves system in single user-mode which user must run interactive mode.
Interactive mode occurs all other times. It requires user interaction. Answer anything yes, fsck fixes issue. If answered no, fsck will perform action again and continue until a yes is selected.
If fsck fails due to corrupted superblock, it requests a valid superblock.
Use fsck with -o option and specify alternate superblock. 32 is always a backup superblock.
Exmample:
# fsck -o b=32 /dev/rdsk/c1t2d0s0
Monitoring File System Usage
4 useful commands:
df - # of free blocks and files
du - summary of disk usage
ff - list file names & statistics for file system
quot - summary of file system ownership
df,du, ff, quot Command
df [-k] [directory]
du [-a] [-s] [-k] [directory]
ff [-l] [-s] [-u] [-i] [directory name]
quot [-a] [-f] [file system...]
prstat Command
# prstat
To quit, type q
crontab Command
File format = minute 0-59 hour 0-23 day-of-month 1-31 month 1-12 day-of-week 0-6 pathtocommand
Each user has a crontab
View crontab for root:
# crontab -l
View crontab for another users:
# crontab -l username
Edit crontab:
# EDITOR=vi
# export EDITOR
# crontab -e
crontab access:
/etc/cron.d/cron.deny
/etc/cron.d/cron.allow
crontab removal:
# crontab -r username
at Command for specific times
Back