[X-Unix] Running fsck on a target disk
Eric F Crist
ecrist at secure-computing.net
Tue Jul 25 05:15:44 PDT 2006
Thom,
There is only one 'trick' to running fsck. You need to define the
mount point as one of the arguments, usually the last. On a typical
Mac system running Mac OS X, you could run fsck on the primary file
system by running:
# fsck_hfs /dev/disk0s3
To run the above command on an HFS formatted file system, type:
# df -h
This allows you to find out where your disk is mounted. When I
connect a USB HFS formatted disk (an old startup volume, actually) I
get:
Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s3 93G 34G 58G 37% /
devfs 100K 100K 0B 100% /dev
fdesc 1.0K 1.0K 0B 100% /dev
<volfs> 512K 512K 0B 100% /.vol
automount -nsl [201] 0B 0B 0B 100% /Network
automount -fstab [205] 0B 0B 0B 100% /automount/
Servers
automount -static [205] 0B 0B 0B 100% /automount/static
/dev/disk1s3 74G 67G 7.2G 90% /Volumes/
Macintosh HD 1
I can see that my new mount, Macintosh HD 1, is filesystem /dev/
disk1s3 which means, 2nd hard disk, slice 3. Computers typically
start counting from 0, so 1 is actually 2. ;)
Finally, to run fsck, we use Apple's fsck_hfs utility against the
above listed filesystem, NOT the mount point, /Volumes/Macintosh HD 1.
# fsck_hfs /dev/disk1s3
I hope this helps!
-----
Eric F Crist
Secure Computing Networks
More information about the X-Unix
mailing list