When I have run
fsck in the past I have always run it on what I thought was a filesystem partition, ie.
fsck -yf /dev/sdaN, where N is the partition number on disk A. A friend of mine recently ran
fsck on his brand new disk and it reported a bunch of errors using
fsck -yf /dev/sda. I am curious, what is the difference between running
fsck on the whole disk (
/dev/sda), verses running it on just a single partition (
When I have run
When fsck runs, it should first try to locate the superblock of a filesystem to begin traversing the filesystem's structure in order to validate it. Since the
/dev/sda device corresponds to whole drive, the first portion of the disk will likely contain the partition table or Master Boot Record and
fsck will not be able to locate the superblock for a supported filesystem (unless you get something that somehow matches a magic number for a known filesystem). I would expect it to exit in error or provide inaccurate output (as your friend experienced). However, I have not yet performed this experiment myself.
It won't work, if the filesystem was installed in a partition (e. g.
fsck and its brethren are tools for performing maintenance on filesystems (hence the name: filesystem ccheck), not of block devices.
It is, I suppose, theoretically possible to put a filesystem directly onto a block device by way of something like
mke2fs -j /dev/sda, but this is very, very bad practice. But if you do, the filesystem would then live directly on
sda, and then to
fsck it, you would indeed just point
fsck at the device. Do not do this. Partition tables are there for a reason, and it's not just to take up a nominal amount of space for a table of contents.
If the device contains a supported filesystem, fsck should work. The device can be an entire hard drive like /dev/sda, or a partition, or a flopy disk (anyone remeber what those were?) like /dev/fd0, or even a file on another hard disk like ~/hdimage.img. For floppy drives the entire drive is normally used, so there is no reason to partition, so the filesystem is made on /dev/fd0. Conventionally hard drives are divided into partitions and file systems are built in the partitions. However if you want to use the whole drive as one partition and you do not need to boot from it, you could make a filesystem directly on the device (mke2fs /dev/sdb), mount it and copy a lot of files to it, then fsck /dev/sdb should work. This has been called a "superfloppy" configuration. I think the old iomega 100MB disks were also normally formatted this way. A disk doesn't even need to have a filesystem- it could have a single file. I often make tar files the right size to fit on a DVD, burn them to the disk. The disk is then not mountable, but tar -xvf some/where/myfile /dev/sr0 extracts myfile from the disk.