2

I have an ubuntu server virtual machine that crashed and I was forced to reset the virtual machine. When I booted, it did an automatic fsck, but I want to make sure that the filesystem is ok. I have searched for instructions on how to run fsck from an ubuntu live cd, but none of the instructions work!

The version of the ubuntu server live cd is 10.04.2 and when the live cd menu appears I chose "Rescue mode". I then went through the questions (similar to those during installation) and the final prompt asks you to choose a "device to use as root file system". I read online that I shouldn't mount the root file system if I want to run fsck, so I chose the option "do not use a root file system". Next option I selected was "execute a shell in the installer environment". I now get a command prompt, but when I try to run fsck /dev/sda1 I get "fsck not found".

I'm completely lost and even the "Official Ubuntu Server 2nd edition" book doesn't explain the procedure properly.

I hope someone more knowledgeable can help me out! Thanks.

2 Answers 2

4

For anyone not seeing the disk devices (/dev/sda1 etc.), be sure to run "Load installer components from CD" from the main menu; say "Do not use a root file system" when prompted.

To run the actual fsck: You are correct that a generic fsck (which on other systems automatically calls the correct filesystem-specific fsck) does not exist. However, a range of filesystem-specific fsck are available, such as fsck.ext4. To see a list, type fsck without hitting enter and press tab twice -- the shell will display a list of possible completions. Pick the one that's appropriate for your file system (ext4 and ext3 are popular). I'm pretty sure that if you pick the wrong one, it will abort with an error message without causing any harm. Example:

fsck.ext4 -f /dev/sda1

This runs the ext4 fsck utility on the first partition of the first SCSI disk. -f forces a full check even if the file system is marked clean.

1
  • You might also want to add -y to avoid considerable amount of "yes" answers.
    – nobeh
    Jun 26, 2014 at 7:16
1

You will have to use the desktop cd (iso). You would boot the live iso with your VM, and run fsck from a terminal.

The server CD, as you can see, has a very limited "live" environment, and is used primarily for installation.

3
  • That's very interesting! I assumed I needed the server CD to fix a server OS installation. I will try this immediately cause the VM needs to be up an running ASAP.
    – joshu
    Jan 25, 2012 at 22:02
  • I was able to run fsck from the desktop ISO and it reported that the filesystem was clean. I'm still surprised that I used the desktop version, but happy that it turned out ok. Thanks for your help.
    – joshu
    Jan 26, 2012 at 8:51
  • You can actually run fsck from the server CD. See my answer.
    – Jo Liss
    Nov 2, 2013 at 22:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .