PDA

View Full Version : Force filesystem check next time you boot


fedetxf
October 17th, 2005, 11:06 AM
This is easy and sometimes needed.

sudo touch /forcefsck

Velox Letum
October 19th, 2005, 08:26 PM
Nice tip...making a simple script into a /usr/bin file for easy access.

kittcankitt
October 27th, 2005, 11:45 PM
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

fedetxf
October 28th, 2005, 09:16 AM
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...

shooterae5
February 18th, 2006, 03:24 PM
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".

dominikgeisler
January 10th, 2008, 07:02 PM
isn't
alias restart='sudo touch /forcefsck && sudo reboot'
a lot easier than the sh file?

zamolxis
June 30th, 2008, 07:04 AM
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:#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: # 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

monoufo
June 30th, 2008, 03:22 PM
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.