Results 1 to 8 of 8

Thread: Force filesystem check next time you boot

  1. #1
    Join Date
    Jul 2005
    Location
    Argentina
    Beans
    27
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Lightbulb Force filesystem check next time you boot

    This is easy and sometimes needed.
    Code:
    sudo touch /forcefsck

  2. #2
    Join Date
    Jul 2005
    Beans
    89
    Distro
    Kubuntu 6.06

    Re: Force filesystem check next time you boot

    Nice tip...making a simple script into a /usr/bin file for easy access.
    Kubuntu 6.06

  3. #3
    Join Date
    Apr 2005
    Beans
    40

    Re: Force filesystem check next time you boot

    Will this just check the filesystem or prompt to fix/repair any problems? If not, how would you go about fixing if problems were reported?

    Nice tip however. Thanks

  4. #4
    Join Date
    Jul 2005
    Location
    Argentina
    Beans
    27
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Force filesystem check next time you boot

    Quote Originally Posted by kittcankitt
    If not, how would you go about fixing if problems were reported?
    If it finds problems a command line appears and you have to enter some sommand I don't remember, but it was somethign like fsck -f /dev/hdaX or something like it. You can use man fsck to check, but it depends on the error it finds...

  5. #5
    Join Date
    May 2005
    Location
    Portland Or.
    Beans
    26
    Distro
    Ubuntu 6.06

    Re: Force filesystem check next time you boot

    I'm learning how to wright scripts, and used this command as one of my first lesions. Here's how I've setup a shortcut using this command:

    - make a directory in your home directory named "bin".
    (most of us have done this already)

    - right click and create a "new file", name it "checkfs.sh"

    - open this file in gedit, and add the lines:

    sudo touch /forcefsck
    sudo reboot

    -save this file.

    - How in your user home dir. go to the view menu and select "show hidden files"

    - locate the ".bashrc" file. This is where you can add aliases to your scripts. About the middle of this file is a section that already has some useful aliases. Add this alias to that section:

    #beginning user added aliases
    alias restart='sh /home/dale/bin/checkfs.sh'

    note: I added the comment (# bla bla bla) so I can find
    all the changes I've made easy. It's a good idea in case
    you break somethnig down the road.

    -save this file.

    Now open a thermal or the run command and type "restart". you'll be asked for the root password, then be logged out, and reboot with the fsck. I know this is very sample to a lot of users, but, this little setup spark a whole bunch of scripts I how use on a regularly. It was kinda like my own "hello world".

  6. #6
    Join Date
    Nov 2007
    Beans
    29

    Re: Force filesystem check next time you boot

    isn't
    Code:
    alias restart='sudo touch /forcefsck && sudo reboot'
    a lot easier than the sh file?

  7. #7
    Join Date
    Feb 2007
    Location
    Toronto, Canada
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Wink Re: Force filesystem check next time you boot

    I'd rather do all my customizations in a separate file.

    Here is an example of a mybashrc file in your ~/bin directory:
    http://ralf.beckesch.de/download/dev/bash/mybashrc

    To call it, you would just add this to your .bashrc:
    Code:
    #if [ -e ~/bin/mybashrc ]; then
            . ~/bin/mybashrc
    fi
    The reason why you would do that is that on large systems, on upgrades, the admin would push a new .bashrc file into your home directory, making you lose your customizations. Although ubuntu might not be doing that, I still think it's a good idea.

    Besides, the existing .bashrc contains the following as a suggestion:
    Code:
    # Alias definitions.
    # You may want to put all your additions into a separate file like
    # ~/.bash_aliases, instead of adding them here directly.
    # See /usr/share/doc/bash-doc/examples in the bash-doc package.
    
    #if [ -f ~/.bash_aliases ]; then
    #    . ~/.bash_aliases
    #fi

  8. #8
    Join Date
    Apr 2006
    Beans
    84

    Re: Force filesystem check next time you boot

    this didn't work. i made it check both my / and /home partition. (you guys should really be using separate partitions for home, I do that in linux and windows), but it didn't fix either of them.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •