You are not logged in.

#1 2006-10-26 17:06:08

twiistedkaos
Member
Registered: 2006-05-20
Posts: 666

How to fix disk

When ever my computer does a disk check it says failed and gives me the option to either fix it manually, or press Ctrl+D to reboot, now of course if I press Ctrl+D and reboot it lets me get throuhg it, but I want to be able to check whats wrong, and how to fix the error it's getting. Anyone mind helping me by giving me a few step throughs on how to do so?

Offline

#2 2006-10-26 17:33:53

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: How to fix disk

Run fsck /dev/[whatever partition] from the root prompt you're given at that point.  DO NOT MOUNT FIRST!  If it's your root partition that's screwed up boot from a live cd or the arch install disk and do the same thing, again w/o mounting your root partition.

FWIW, I'm having the exact same issue on two different arch boxen - I think it's tied to the issue where my superblocks all claim to have a date/time in the future.  It's possible there's nothing wrong with yout file systems.  Better safe than sorry, though.


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#3 2006-10-26 18:07:02

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: How to fix disk

If you do:

touch /forcefsck

all of your filesystems will get checked on next reboot.  Handy for checking your / partition.


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#4 2006-10-26 18:21:16

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: How to fix disk

Cool! Yet another trick I didn't know about.  Can't ever have too many in your toolkit.


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#5 2006-10-26 19:09:01

twiistedkaos
Member
Registered: 2006-05-20
Posts: 666

Re: How to fix disk

Thanks, I'll see smile. I can still boot into my arch box, it just fails when it has to check filesystems for some reason.

Offline

#6 2006-10-26 21:52:07

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: How to fix disk

For the record you don't need to boot into a live cd to check your root fs:

If already running: telinit S
At grub: add the letter S at the end of the kernel line. Note it is a capital S.

This will get you into single user mode where you can remount your drive as read-only:   mount -o remount,ro /dev/hdxy

If you get errors on not being able to re-mount (from doing a telinit) you'll need to kill off some processes that are using it. Don't worry they be restarted later. Syslog-ng and udev could be possible culprits: /etc/rc.d/syslog-ng stop

Now with your rootfs unmount you can safely perform a check:  e2fsck -f /dev/hdxy
The -f forces the check even though marked clean (from your second boot marking it clean after not acting on the filesystem check warning the first time)

Once its complete get back into multi-user mode: telinit 3
For most people it will be 3 but if you specifically changed it in inittab than it may be 5 (X11).

Offline

#7 2006-10-29 12:45:39

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: How to fix disk

Penguin wrote:

This will get you into single user mode where you can remount your drive as read-only:   mount -o remount,ro /dev/hdxy
...
Now with your rootfs unmount you can safely perform a check:  e2fsck -f /dev/hdxy

Are you sure it is a good idea to fsck mounted partition, even read-only? As far as I can remember, it always caused troubles, or worse...

-Miky.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#8 2006-10-29 23:41:21

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: How to fix disk

mr.MikyMaus wrote:

Are you sure it is a good idea to fsck mounted partition, even read-only? As far as I can remember, it always caused troubles, or worse...

-Miky.

I'm pretty sure it is safe, as long as the partition isn't being written to.  If data on the disk starts changing (say a log file) while fsck is going, all hell will break loose.  If the partition is mounted read only, it's just like reading the data as if the partition wasn't mounted, i.e. straight off the disk with no chance of it changing (unless the actual hardware breaks somehow).  And any programs being read from the disk will be in the RAM anyway.  So, the partition being mounted shouldn't really matter at all.

Disclaimer:  I've never tried it, so if it turns out I'm wrong, I'm not to blame.  I'm going by logic wink  Someone please correct me if need be.


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#9 2006-10-30 00:03:56

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: How to fix disk

chrismortimore wrote:

Disclaimer:  I've never tried it, so if it turns out I'm wrong, I'm not to blame.  I'm going by logic wink  Someone please correct me if need be.

That's it. Your logic is right, as was mine. I tried it (or at least I *think* I did it) this way about two years ago. My root was damaged (power leak I think) and I had no live-cd by hand. So I tried "maintenance" mode (aka runlevel S), did mount -o remount,ro / and fsck -f / ...

Long story short: I had to reinstall smile I don't remember what exactly gone wrong, nor if I did all correctly. I was Linux rookie that time:)

Maybe I'll try and verify it sometimes, when I have some spare harddrive. But until then I'll be better safe than sorry wink

-M.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#10 2006-10-30 07:31:21

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: How to fix disk

mr.MikyMaus wrote:

That's it. Your logic is right, as was mine. I tried it (or at least I *think* I did it) this way about two years ago. My root was damaged (power leak I think) and I had no live-cd by hand. So I tried "maintenance" mode (aka runlevel S), did mount -o remount,ro / and fsck -f / ...

From /etc/rc.sysvinit:

status "Mounting Root Read-only" /bin/mount -n -o remount,ro /

FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
NETFS="nonfs,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,nousbfs,noshfs,nofuse"

if [ -x /sbin/fsck ]; then
        stat_busy "Checking Filesystems"
        if [ "`cat /proc/cmdline | grep quiet`" ]; then
                /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK >/dev/null 2>&1
        else
                /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK
        fi

As you can see from this, when you boot, the root filesystem is mounted read only, and then fscked.  So at least my logic was right.  And it would appear that it is safe to do.


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#11 2006-10-30 10:32:43

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: How to fix disk

chrismortimore wrote:

As you can see from this, when you boot, the root filesystem is mounted read only, and then fscked.  So at least my logic was right.  And it would appear that it is safe to do.

Yes, yes, I concur, this method really *IS* safe. Until there are some errors which cannot be fixed just by re-running journal.

Once fsck is required to do a thorough scan and fix some journal-unrelated errors (eg. bad superblock, somehow orphaned inodes etc..), even read-only mounted filesystem gets damaged. Don't ask me why, I do not know. I hope I'm wrong on this one smile But this is my experience...

-M.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#12 2006-10-30 13:16:08

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: How to fix disk

mr.MikyMaus wrote:

Yes, yes, I concur, this method really *IS* safe. Until there are some errors which cannot be fixed just by re-running journal.

Once fsck is required to do a thorough scan and fix some journal-unrelated errors (eg. bad superblock, somehow orphaned inodes etc..), even read-only mounted filesystem gets damaged. Don't ask me why, I do not know. I hope I'm wrong on this one smile But this is my experience...

Wooyay, I win! *does happy dance*

I am quite curious about what you're saying though... I might dig out the ol' VMware and destroy an installation on it to see what happens...


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#13 2006-10-30 17:52:15

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: How to fix disk

I've done this a million times now. There's nothing unsafe about it as long as it is mounted read-only.

Offline

Board footer

Powered by FluxBB