Solved How to clear the "dirty" bit from a temporary mount?

Greetings, All!
I recently temporarily mount(8)ed an image file to /mnt. While I was
away from the terminal, /var overflowed, and the system bounced. I ran fsck(8) against the disks, in single user mode, and rebooted to multi-user, and everything was fine, until I attempted to mount(8) the image to /mnt again. Where it proclaimed:
Code:
WARNING: /mnt was not properly dismounted
OK. So what's the deal? /mnt is not in fstab(5). So, who gives a s{...}t? :)

Thanks for anything to clear this up. :)

--Chris
 
Since the filesystem in question does not appear in /etc/fstab, you must tell fsck(8) all about it. For example, if you have a UFS filesystem on /dev/da0p1 ( gpart show can show you that), then you would say something like:

fsck -t ufs -y /dev/da0p1

So if you wanted to check a UFS filesystem in an image file, you could say:

mdconfig -a -u 0 -f {pathname}
fsck -t ufs -y /dev/md0
 
Since the filesystem in question does not appear in /etc/fstab, you must tell fsck(8) all about it. For example, if you have a UFS filesystem on /dev/da0p1 ( gpart show can show you that), then you would say something like:

fsck -t ufs -y /dev/da0p1
This was the magic. :)

So if you wanted to check a UFS filesystem in an image file, you could say:

mdconfig -a -u 0 -f {pathname}
fsck -t ufs -y /dev/md0
I tried this first, but it failed, with:
Code:
fsck -t ufs /dev/md0
** /dev/md0 (NO WRITE)
Cannot find file system superblock
ioctl (GCINFO): Inappropriate ioctl for device
fsck_ufs: /dev/md0: can't read disk label
No matter. You're other example succeeded. Thanks!
I never would have guessed that a temporarily mounted image file would care. I was sure that the record(s) would have simply been abandoned. Not unlike tmpfs(5). Who knew? Not me. :p

Thanks for the enlightening reply!

--Chris
 
OK. I spoke too soon. After fsck(8), and umount(8)ing it. Then removing the md(4) unit. I then re-created the md(4) unit with the same image, then mount(8)ed it, and guess what... same error
Code:
WARNING: /mnt was not properly dismounted
This is what fsck(8) reported, when I performed it, as per your suggestion:
Code:
fsck -f -t ufs /dev/md0a
** /dev/md0a (NO WRITE)
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
1800 files, 9669 used, 9582 free (30 frags, 1194 blocks, 0.2% fragmentation)
Note the NO WRITE. Any attempts to mount(8) rw simply fail silently. :(

Any other thoughts?

Maybe I should just recreate /mnt -- umount(8) it, delete it, then re-create it. :/

Thanks!

--Chris
 
Boy! I can be such a dimwit, sometimes. :p
Of course the image can't be mount(8)ed to effectively fsck(8) it. You'd think the READ ONLY notice would have tipped me off. But nooooo. I've got w-a-y too much on my plate, right now. I think I'd better take a step back, and re-evaluate. Before I do something really stupid.

Ever have one of those days?

Can't thank you enough, Uniballer. I'd hit the "thanks" button 50 times, if it'd do any good. :)

--Chris
 
Back
Top