|
OSXFAQ Mac OS X UNIX Tip-of-the-Day

Week 100 - Trouble-Shooting (28 February 2005)
by
Adrian Mayo - Editor, OSXFAQ
Friday - Disc Drives
/Applications/Utilities/Disk Utility allows one the verify and repair permissions on the system volume, and verify and repair the structure of other volumes. These functions can be performed from the command line using 'diskutil'
To refer to a specific disc/volume, specify its mount point, disc identifier, or device node, as below.
The mount point is usually /Volumes/disc-name, but in my case I have mounted directly under /.
$ diskutil verifyDisk /Music/
Started verify/repair on disk disk0s9 Music-saruman
Checking HFS Plus volume.
Checking Extents Overflow file.
Checking Catalog file.
Checking Catalog hierarchy.
Checking volume bitmap.
Checking volume information.
The volume Music-saruman appears to be OK.
Verify/repair finished on disk disk0s9 Music-saruman
To discover the disc identifier and device node use disktool.
$ disktool -l
...
***Disk Appeared ('disk0s3',Mountpoint = '/', fsType = 'hfs', volName = 'OSX-saruman')
***Disk Appeared ('disk0s5',Mountpoint = '/Users', fsType = 'hfs', volName = 'Users-saruman')
***Disk Appeared ('disk0s7',Mountpoint = '/Games', fsType = 'hfs', volName = 'Games-saruman')
***Disk Appeared ('disk0s9',Mountpoint = '/Music', fsType = 'hfs', volName = 'Music-saruman')
$ diskutil verifyDisk disk0s9
Started verify/repair on disk disk0s9 Music-saruman
Checking HFS Plus volume.
...
Verify/repair finished on disk disk0s9 Music-saruman
$ diskutil verifyDisk /dev/disk0s9
Started verify/repair on disk disk0s9 Music-saruman
Checking HFS Plus volume.
...
Verify/repair finished on disk disk0s9 Music-saruman
To repair use:
$ diskutil repairDisk /Music
Started verify/repair on disk disk0s9 Music-saruman
Checking HFS Plus volume.
Checking Extents Overflow file.
Checking Catalog file.
Checking Catalog hierarchy.
Checking volume bitmap.
Checking volume information.
The volume Music-saruman appears to be OK.
Verify/repair finished on disk disk0s9 Music-saruman
To verify and repair permissions (of the boot volume), use:
diskutil verifyPermissions /OSX-saruman
diskutil repairPermission /OSX-saruman
NOTE: the name of your system volume will differ from mine.
To repair the boot volume you must boot into single user mode. It is not possible to repair a volume that is mounted and cannot be unmounted (ie is always in use).
Restart holding down the Command-S key combination and wait until the text has finished scrolling. Next mount the system volume as writable (it is currently mounted as read-only at this stage of the boot process).
Type:
$ mount -uw /
Then check/repair the file system with:
$ fsck -y
or, for journalled filesystems (the default in Pather):
$ fsck -fy
If fsck reports problems with something like:
***** FILE SYSTEM WAS MODIFIED *****
re-run fsck until it reports that no modifications were necessary.
Hit control-d to continue the boot process, or type:
$ reboot
Repair non-boot volumes. Sometimes it is not possible to repair other volumes because they cannot be unmounted (for example if you have your home directory on another partition). In this case the offending volume has to be repaired in single user mode just like the system volume.
For example, to repair HFS disc 0 partition 9:
fsck_hfs -fy /dev/rdisk0s9
Refer to 'disktool' above to get the disc and partition numbers, or use command 'df' in single user mode.
If you want to learn more about Mac OS X Unix visit the Learning Center
click.
- For beginners: Mac OS X Unix Tutorials
- For detailed information on specific topics: Advanced Unix
- For OS X in gereral: Mac OS X Tutorials
|