How to use fsck in Ubuntu?












13















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.

    – Panther
    Oct 4 '13 at 17:51


















13















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.

    – Panther
    Oct 4 '13 at 17:51
















13












13








13


2






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
















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.





boot mount fsck






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:24









Community

1




1










asked Oct 4 '13 at 17:46









Tomáš PečenýTomáš Pečený

49061133




49061133













  • 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.

    – Panther
    Oct 4 '13 at 17:51





















  • 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.

    – Panther
    Oct 4 '13 at 17:51



















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.

– Panther
Oct 4 '13 at 17:51







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.

– Panther
Oct 4 '13 at 17:51












2 Answers
2






active

oldest

votes


















6














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?

    – Tomáš Pečený
    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.

    – Panther
    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.

    – Tomáš Pečený
    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.

    – Tomáš Pečený
    Oct 4 '13 at 18:55



















0














I concur with @bodhi.zazen comment here. The best way to go about checking a filesystem is to boot from live media, choose "Try Ubuntu" and then manually fsck the partition in question. For example sudo fsck /dev/ZdXY where ZdXY is the partition in question. sudo fdisk -l will give you a listing of your drives and the partitions on them. This information should be sufficient for you to determine which partition you need to check.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f353732%2fhow-to-use-fsck-in-ubuntu%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    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?

      – Tomáš Pečený
      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.

      – Panther
      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.

      – Tomáš Pečený
      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.

      – Tomáš Pečený
      Oct 4 '13 at 18:55
















    6














    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?

      – Tomáš Pečený
      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.

      – Panther
      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.

      – Tomáš Pečený
      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.

      – Tomáš Pečený
      Oct 4 '13 at 18:55














    6












    6








    6







    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













    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












    share|improve this answer



    share|improve this answer










    answered Oct 4 '13 at 17:52









    DanDan

    5,22721840




    5,22721840













    • Can I set (using the Main Menu) the fsck option to -V to get full information about the checking?

      – Tomáš Pečený
      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.

      – Panther
      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.

      – Tomáš Pečený
      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.

      – Tomáš Pečený
      Oct 4 '13 at 18:55



















    • Can I set (using the Main Menu) the fsck option to -V to get full information about the checking?

      – Tomáš Pečený
      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.

      – Panther
      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.

      – Tomáš Pečený
      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.

      – Tomáš Pečený
      Oct 4 '13 at 18:55

















    Can I set (using the Main Menu) the fsck option to -V to get full information about the checking?

    – Tomáš Pečený
    Oct 4 '13 at 17:58





    Can I set (using the Main Menu) the fsck option to -V to get full information about the checking?

    – Tomáš Pečený
    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.

    – Panther
    Oct 4 '13 at 18:04





    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.

    – Panther
    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.

    – Tomáš Pečený
    Oct 4 '13 at 18:24





    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.

    – Tomáš Pečený
    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.

    – Tomáš Pečený
    Oct 4 '13 at 18:55





    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.

    – Tomáš Pečený
    Oct 4 '13 at 18:55













    0














    I concur with @bodhi.zazen comment here. The best way to go about checking a filesystem is to boot from live media, choose "Try Ubuntu" and then manually fsck the partition in question. For example sudo fsck /dev/ZdXY where ZdXY is the partition in question. sudo fdisk -l will give you a listing of your drives and the partitions on them. This information should be sufficient for you to determine which partition you need to check.






    share|improve this answer




























      0














      I concur with @bodhi.zazen comment here. The best way to go about checking a filesystem is to boot from live media, choose "Try Ubuntu" and then manually fsck the partition in question. For example sudo fsck /dev/ZdXY where ZdXY is the partition in question. sudo fdisk -l will give you a listing of your drives and the partitions on them. This information should be sufficient for you to determine which partition you need to check.






      share|improve this answer


























        0












        0








        0







        I concur with @bodhi.zazen comment here. The best way to go about checking a filesystem is to boot from live media, choose "Try Ubuntu" and then manually fsck the partition in question. For example sudo fsck /dev/ZdXY where ZdXY is the partition in question. sudo fdisk -l will give you a listing of your drives and the partitions on them. This information should be sufficient for you to determine which partition you need to check.






        share|improve this answer













        I concur with @bodhi.zazen comment here. The best way to go about checking a filesystem is to boot from live media, choose "Try Ubuntu" and then manually fsck the partition in question. For example sudo fsck /dev/ZdXY where ZdXY is the partition in question. sudo fdisk -l will give you a listing of your drives and the partitions on them. This information should be sufficient for you to determine which partition you need to check.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 6 '17 at 12:51









        Elder GeekElder Geek

        27.4k955128




        27.4k955128






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f353732%2fhow-to-use-fsck-in-ubuntu%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Mouse cursor on multiple screens with different PPI

            Agildo Ribeiro

            Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”