Manual fsck help in fedora

I am trying to do a manual fsck in Fedora. So far I have not had any luck. I have tried the easy way like this.

sudo touch /forcefsck

Since that didn't work I tried the manual way.

sudo fsck.ext4 /dev/mapper/vg_hi-lv_home
sudo fsck.ext4 /dev/mapper/vg_hi-lv_root

Since I got mounted errors I tried to unmount them next.

sudo umount /dev/mapper/vg_hi-lv_root
sudo umount /dev/mapper/vg_hi-lv_home

I got the usual busy messages so I tried to fix that with these commands.

sudo fuser -km /dev/mapper/vg_hi-lv_root
sudo fuser -km /dev/mapper/vg_hi-lv_home

Every time I run the commands above it logs me out. Can I please have some ideas on what to try next?

Suggest you try rebooting and adding the following to the kernel command line via GRUB while booting:

fsck.mode=force
1 Like

If you are trying to unmount your own root partition, I think you'll have problems doing that...
You can force fsck to read mounted volumes, just don't let it make any changes (I think that's the -f and -n flags, but check your man page).

If you want to do a proper fsck of root including repairs, you'll really want to boot off something else (pop a boot disk in the drive and reboot) then run your fsck.

To easily get at /home, just boot up into single user / maintenance mode ('init', 'reboot' or 'halt' commands should do this for you - again, check your man pages for the flags to use to get single user mode).

A slightly more ghetto solution (I have been know to do this on occasion) is to hard power cycle the server (ie pull the cord out of the back rather than press the power button) which will force an fsck on bootup. That said, it might also corrupt the filesystem so, you know, maybe don't do this if the data really really matters. :slight_smile:

Is this similar to going into single user mode and unmounting your drives, then running fsck? Your way has less steps :).

Single user mode worked :).

Is there a difference between single user mode, pressing ctrl+alt+f2 and logging into root, or using sudo -i? I figured pressing ctrl+alt+f2 and logging into root, or using sudo -i would have the same effect as using single user mode.

If by Single user mode you mean the "Emergency"- or "Multiuser"-mode/.target then: no.
Those are 'init 1' or 'init 3', while the DE requires Graphical.target (init 5).

Init 1: Wont let you login, you're automaticly root (no other TTY's)
Init 3: Requires textual login for any passed loginname (multiple TTY's)
Init 5: Should prompt you with a graphical login screen (multiple TTY's)

By pressing ctrl+alt+f2 you're simply accessing TTY 2.
By default, a distro 'supports' (out of the box) only 1 TTY to display a DE.
(of course this can be changed, but requires some experience)

Accessing another TTY from DE/GUI, will have a very 'diffrent' environment than you face in emergency(.target) stage,
in which usualy /home is not mounted, wifi drivers are not loaded and similar...

Hope this helps?

Awesome :slight_smile: :slight_smile:

Yeah, single user mode is, well, a mode with only one user :slight_smile:
It's like a barebones boot with only the very basic stuff loaded to get the OS going. You can actually set more stuff to start up when you boot single-user but that's asking for trouble as the whole point of single-user mode is to be as basic as possible.

The main differences are:

  • There's only the root user and only one user at a time, not multiuser at all (some OS's kind of cheat here though)
  • Most filesystems don't mount, and most processes don't start, so it's easier to work on the filesystems without other stuff getting in the way.

You can exit single user mode by simply logging out (exit or ^d) and it should carry on up to multi-user. That said, I actually prefer to reboot round to multi-user instead but that may be me just being overly paranoid :slight_smile: