fsck syntax to use when system says / needs checking?
![](https://seccdn.libravatar.org/avatar/2f3444d3e0dc6ba37055cfb6debe7054.jpg?s=120&d=mm&r=g)
I have an unpatched 9.2 Linux system which I turn on/off daily to use it as opposed to leaving it running, due to power constraints. After plugging in an external HDD via USB and initiating a cp to make a backup, before doing a complete system update online, I cancelled the backup due to time constraints, the fsck error from hell has been haunting me. The other day I powered on, and whilst the system was checking if the fs were clean, I was asked to enter the root password as the / (dev/hda1) fs needed repairing. It was mounted read only and to mount it read/write I would need to issue #mount -n -o remount,rw /. I entered the password and remounted / as rw. Initially I tried #fsck / which returned that the journal had neen recovered, however there was a JBD error which I'll cover in anoter mail. After CTRL-D to reboot the system again complained about / needing checking. Hauling out the books I have to get the right fsck syntax, I noticed that not one of Running Linux by Welsh et al or suSE Linux by Brown, or Using Linux by QUE had the required syntax if a system should need repairing. Looking at the options of fsck I tried #fsck -pcfv /dev/hda1 and again got the KBD error after the journal was recovered. Since this wierdness had only happened after messing around with the USB external HDD I vi'd the /etc/fstab file and removed the lines containing info on the USB devices( a thumb drive and the external HDD). Now I wish I had made a backup copy of the fstab before I changed it but it was pre-coffee time and about 2am. I rebooted and the machine booted into KDE and I was able to browse te SuSE archives at http://marc.theaimsgroup.com/?l=suse-linux-e&r=1&w=2 I did not find a solution there either. Would a kind sole please let me know what fsck syntax I should use if the / or any other partition needs repairing? The fsck error from hell has meant that I have left the machine running and susceptible to power outages. TIA Hylton -- ======================================================================== Currently using SuSE 9.2 Professional with KDE and Mozilla 1.7.2 Linux user # 229959 at http://counter.li.org ========================================================================
![](https://seccdn.libravatar.org/avatar/5a94d2f8a5845d5f1c1ea1556fc0cb72.jpg?s=120&d=mm&r=g)
Hylton Conacher(ZR1HPC) wrote:
I entered the password and remounted / as rw. Initially I tried #fsck / which returned that the journal had neen recovered, however there was a JBD error which I'll cover in anoter mail. After CTRL-D to reboot the system again complained about / needing checking.
You should never ever do am fsck on a rw mounted partition.
Would a kind sole please let me know what fsck syntax I should use if the / or any other partition needs repairing? The fsck error from hell has meant that I have left the machine running and susceptible to power outages. It depends on the filesystem. for ext3, man fsck.ext3. In a pinch, fsck.ext3 -f /dev/hdxx, replacing xx with the correct drive and partition.
-- Joe Morris Registered Linux user 231871
![](https://seccdn.libravatar.org/avatar/2f3444d3e0dc6ba37055cfb6debe7054.jpg?s=120&d=mm&r=g)
Hylton Conacher(ZR1HPC) wrote:
I entered the password and remounted / as rw. Initially I tried #fsck / which returned that the journal had neen recovered, however there was a JBD error which I'll cover in anoter mail. After CTRL-D to reboot the system again complained about / needing checking.
You should never ever do am fsck on a rw mounted partition.
Would a kind sole please let me know what fsck syntax I should use if the / or any other partition needs repairing? The fsck error from hell has meant that I have left the machine running and susceptible to power outages.
It depends on the filesystem. for ext3, man fsck.ext3. In a pinch, fsck.ext3 -f /dev/hdxx, replacing xx with the correct drive and
Joe Morris (NTM) wrote: partition. Joe Morris (NTM) wrote:
Hylton Conacher(ZR1HPC) wrote:
I entered the password and remounted / as rw. Initially I tried #fsck / which returned that the journal had neen recovered, however there was a JBD error which I'll cover in anoter mail. After CTRL-D to reboot the system again complained about / needing checking.
You should never ever do am fsck on a rw mounted partition. Why, Surely fsck would need to write changes to correct the fs? So you are saying that eventhough they mention the option of remounting RW, I shouldm't?
Would a kind sole please let me know what fsck syntax I should use if the / or any other partition needs repairing? The fsck error from hell has meant that I have left the machine running and susceptible to power outages.
It depends on the filesystem. for ext3, man fsck.ext3. In a pinch, fsck.ext3 -f /dev/hdxx, replacing xx with the correct drive and partition. Doh, Forgot to mention the fs. fs is ext3. -- ======================================================================== Currently using unpatched SuSE 9.2 Professional with KDE and Mozilla 1.7.2 Linux user # 229959 at http://counter.li.org ========================================================================
![](https://seccdn.libravatar.org/avatar/5a94d2f8a5845d5f1c1ea1556fc0cb72.jpg?s=120&d=mm&r=g)
Joe Morris (NTM) wrote:
You should never ever do an fsck on a rw mounted partition. Why, Surely fsck would need to write changes to correct the fs? So you are saying that eventhough they mention the option of remounting RW, I shouldm't? from the e2fsck man page, "Note that in general it is not safe to run e2fsck on mounted file systems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified. However, even if it is safe to do so, the results printed by e2fsck are not valid if
Hylton Conacher(ZR1HPC) wrote: the file system is mounted. If e2fsck asks whether or not you should check a file system which is mounted, the only correct answer is ``no''. Only experts who really know what they are doing should consider answering this question in any other way." IIUC, the file system needs to be stable and quiet to be checked, and if it is mounted rw, activity could change things and make the check worse than useless. Unless needed to run the fsck command, like the root file system, which would need to be mounted to access the command, and thus is mounted ro by the repair system, you should fsck an unmounted (and therefore guaranteed quiet) file system. HTH. BTW, it can write to repair the system without it being mounted, just as fdisk can write a partition table to an blank and unmountable HD. It was written to do so. -- Joe Morris Registered Linux user 231871
![](https://seccdn.libravatar.org/avatar/2f3444d3e0dc6ba37055cfb6debe7054.jpg?s=120&d=mm&r=g)
Joe Morris (NTM) wrote:
Hylton Conacher(ZR1HPC) wrote:
Joe Morris (NTM) wrote:
You should never ever do an fsck on a rw mounted partition.
Why, Surely fsck would need to write changes to correct the fs? So you are saying that eventhough they mention the option of remounting RW, I shouldm't?
from the e2fsck man page <snip>
Thanks Joe, Now I understand. -- ======================================================================== Currently using unpatched SuSE 9.2 Professional with KDE and Mozilla 1.7.2 Linux user # 229959 at http://counter.li.org ========================================================================
![](https://seccdn.libravatar.org/avatar/99bbf0e2807d0c1a81e021665cc9e09f.jpg?s=120&d=mm&r=g)
On Monday 18 September 2006 10:37, Hylton Conacher(ZR1HPC) wrote:
The other day I powered on, and whilst the system was checking if the fs were clean, I was asked to enter the root password as the / (dev/hda1) fs needed repairing. It was mounted read only and to mount it read/write I would need to issue #mount -n -o remount,rw /.
I entered the password and remounted / as rw. Initially I tried #fsck / which returned that the journal had neen recovered,
If i'm not mistaken, the commands are filesystem specific. i'm assuming you're using reiserfs because you mention a journal (maybe XFS or ext3?). If it's reiserfs, try this: ~> reiserfsck --help reiserfsck: unrecognized option `--help' Usage: reiserfsck [mode] [options] device Modes: --check consistency checking (default) --fix-fixable fix corruptions which can be fixed without --rebuild-tree --rebuild-sb super block checking and rebuilding if needed (may require --rebuild-tree afterwards) --rebuild-tree force fsck to rebuild filesystem from scratch (takes a long time) --clean-attributes clean garbage in reserved fields in StatDatas Options: -j | --journal device specify journal if relocated -B | --badblocks file file with list of all bad blocks on the fs -l | --logfile file make fsck to complain to specifed file -n | --nolog make fsck to not complain -z | --adjust-size fix file sizes to real size -q | --quiet no speed info -y | --yes no confirmations -V prints version and exits -a and -p some light-weight auto checks for bootup -f and -r ignored Expert options: --no-journal-available do not open nor replay journal -S | --scan-whole-partition build tree of all blocks of the device Then try: ~> reiserfschk --fix-fixable /device/name That may tell you that you need to use --rebuild-tree. Don't use --rebuild-tree unless you NEED to, because it can lose data. In my experience, however, it has lost only a couple very old files which i hadn't touched in years. -- ----- stephan@s11n.net http://s11n.net "...pleasure is a grace and is not obedient to the commands of the will." -- Alan W. Watts
![](https://seccdn.libravatar.org/avatar/77cb4da5f72bc176182dcc33f03a18f3.jpg?s=120&d=mm&r=g)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Monday 2006-09-18 at 10:37 +0200, Hylton Conacher(ZR1HPC) wrote:
Would a kind sole please let me know what fsck syntax I should use if the / or any other partition needs repairing? The fsck error from hell has meant that I have left the machine running and susceptible to power outages.
Simply "fsck /dev/device" should work. Notice that it may not work on a mounted device. That means that if the "/" is reiserfs, you have to boot from CD too check it, for instance, using reiserfsck instead (did fsck work for reiserfs? Perhaps it does, I don't remember). Also, you should know that if the fstab file defines a partition that can not be found at boot time, the script will leave you with the rescue prompt for you to solve the problem - but it will not tell you what the problem is. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFFDn8QtTMYHG2NR9URAr8lAJ9IjdfN9wKh1IPGUgfHGkK6rCvuhACeLrZv Qsi/siEHXWnRtkpQodmzwaA= =f6FZ -----END PGP SIGNATURE-----
participants (4)
-
Carlos E. R.
-
Hylton Conacher(ZR1HPC)
-
Joe Morris (NTM)
-
stephan beal