Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I intend to use fsck for checking my Linux partition of the main disk, because its file system is suspicious of being

not unmounted cleanly
by shutting down the system. I have searched in my environment variables: none of them except of PATH should control the fsck program. But the program apparently needs to be used during a boot:
:~$ fsck -V
fsck from util-linux 2.20.1
Checking all file systems.
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/sda6 
e2fsck 1.42 (29-Nov-2011)
/dev/sda6 is mounted.
WARNING!!! The filesystem is mounted. If you continue you WILL cause SEVERE filesystem damage. Do you really want to continue? no check aborted.
(There is no /forcefsck file in my root according to How do I find out if there will be a fsck during the next boot? . My etc/fstab file contains

 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#                
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda6 during installation
UUID=1ac55d8d-c112-4bc7-9e79-921d196f9f79 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda7 during installation
UUID=54f7e314-50e2-419b-a45d-47c3058ecc00 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

).
According to an answer to Slow reboot - understanding fsck and tune2fs I have tried tune2fs hoping that I'll get the present value of the

max_mounts_count
parameter to be able to set it to 1 for checking the partition during the next boot. But after
sudo rm /var/lib/update-notifier/fsck-at-reboot
and a restart I have only got a response
:~$ tune2fs -l /dev/sda6
tune2fs 1.42 (29-Nov-2011)
tune2fs: Permission denied while trying to open /dev/sda6
Couldn't find valid filesystem superblock
. Can I use
sudo tune2fs -l /dev/sda6
safely? Thanks.

share|improve this question
    
You need to run all those commands from a live USB with the target partition(s) unmounted. If fsck can not automatically fix the problems(s) your hard drive may be failing and you should back up your data. –  bodhi.zazen Oct 4 '13 at 17:51

1 Answer 1

up vote 4 down vote accepted

To run fsck on your harddrive you need to boot a liveCD and then run the commands with your harddrive partitions as the target.

"There is no /forcefsck file in my root"

-You need to create the file, it is just a blank file so run sudo touch /forcefsck and fsck will check your drive next time your reboot.

share|improve this answer
    
Can I set (using the Main Menu) the fsck option to -V to get full information about the checking? –  Tomas Peceny Oct 4 '13 at 17:58
    
IMO it is best to run various repair commands from a live CD. fsck works "OK" on auto pilot when booting, but if you have problems you are going to want to manually recover. If the problem is severe enough your system may fail to boot. I highly advise you review the man page and/or information about data recovery as those commands can result in data loss if not used with care. –  bodhi.zazen Oct 4 '13 at 18:04
    
It works, thanks, I have accepted the answer. But running fsck, suggested by ghost 8, has not helped for making the partition image. I am asking a new question about it. –  Tomas Peceny Oct 4 '13 at 18:24
    
I see the new question is not necessary, it is probably solved by manpages.ubuntu.com/manpages/hardy/man8/dump.8.html and manpages.ubuntu.com/manpages/hardy/man8/restore.8.html. –  Tomas Peceny Oct 4 '13 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.