Deep checking Solaris ufs filesystem

I'm prompted to start this thread following my attempt to help on this thread here (see my posts).

I was proposing the OP deep checked a Solaris ufs filesystem using:

 # fsck -o full <filesystem node>

however this option does not appear to be valid on Solaris 10.

I've used this option on many Unix/Linux versions over the years but, very often, it's availability not documented and often doesn't appear on man pages but is still there. I'm as sure as I can be that '-o full' was available on Solaris fsck in versions 2.51, 5.6 and 5.8 but seems its been removed on Solaris 10.

So this begs the question: How do you deep check a Solaris 10 ufs filesystem? If you want to check the superblock, every inode, allocated sectors, the check all those sectors are readable, how can you do it? What options/switches do you use so you check EVERYTHING is readable except free space.

I strongly doubt that the "-o full" option was ever implemented for UFS. You might be confusing with vxfs which was indeed supporting it.

1 Like

I think it exists for the Veritas vxfs.

1 Like

Yes, I meant it was already supported under older versions of Solaris. There is no reason for this support to be dropped in current versions.

So what is the deepest check you can run on Solaris ufs filesystem then?

Is it possible to read all used sectors, ie, follow all inode allocated sectors to check that they're readable?

This should be close to what you are looking for:

find $mountpoint -mount -fstype ufs -type f -exec ksh -c 'for i do dd if="$1" of=/dev/null bs=1024k 2>/dev/null || printf "%s\n" "$1" >> /tmp/failed; printf "\r%s    " "$i" ; done' ksh {} + ; echo
2 Likes

So you have to "do it yourself" with your own script. There are no system tools to allow you to do it? No switches on fsck or anything?

Fsck was designed to check the file system integrity and to repair it when possible. There is no way with fsck to repair the files themselves. Even if all of their blocks are readable, that doesn't mean they are not (silently) corrupted.

That's one of the reasons why UFS is essentially obsolete and replaced by ZFS under Solaris.

With ZFS, you can use "scrub" to check and repair everything, including file contents when there is redundancy (ditto blocks, raidz or mirror).

3 Likes

I accept that and appreciate why the world has moved to ZFS.

Yes, files can be silently corrupted but, as in the other thread that I referenced, the OP had a system that hung during boot and knew the disk was iffy. I hoped that a 'fsck -o full' would tell him which files had bad spots so he knew which files to rewrite. Hence my discussion about whether there are any other tools to read all used disk space.

Anyway, as always with you j-l, thank you for the comprehensive answer.

1 Like