Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: how to fsck?
PostPosted: Tue May 18, 2004 9:38 am 
Offline
Newbie

Joined: Tue May 18, 2004 9:32 am
Posts: 4
okay, major newbie alert here. i just started with linode, so here goes:

How do I run fsck? I've searched online, but am kinda lost. It seems to me that I need to boot into single-user mode, but there's where I'm stuck...

I've noticed the radio box in the Configs section, but checking single user mode and rebooting my linode does what? And then how do I get into my Linode (what user), and what do I do to run fsck.

I got into the Lish console, and tried to run 'fsck /dev/ubda' but no go, and I'm lost now...

thanks,
aj


Top
   
 Post subject: Re: how to fsck?
PostPosted: Tue May 18, 2004 8:02 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
yo-yo wrote:
I got into the Lish console, and tried to run 'fsck /dev/ubda' but no go, and I'm lost now...

Make sure you attached to your console, and NOT at the Lish prompt. It should have worked. To reiterate:

Set your config profile to "Single User Mode", reboot. Connect to the console (it should attach to the console automatically), then run:

Code:
fsck.ext3 /dev/ubda


Just "fsck" should also work -- it's pretty smart about determining the type of filesystem you want to check..

The other option is to deploy a small distro (like Debian), and add the disk image you want to fsck to the config profile (say, as /dev/ubdc), boot the small distro (not in single user mode), connect via ssh, do NOT mount /dev/ubdc, and run fsck /dev/ubdc.

-Chris


Top
   
 Post subject:
PostPosted: Tue May 18, 2004 8:04 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
You can only run fsck against "quiescent" filesystems; basically those that are unmounted. So if you have a data disk that can be unmounted then you can run fsck against it while the machine is live. However the root partition can't be umounted and so that can only be fsck'd in single user mode (or very early on in the boot sequence).

To fsck a disk you need to know the device name for it. This can be found (normally) by looking in /etc/fstab. eg on my linode:
# cat /etc/fstab
/dev/ubda / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/ubdb swap swap defaults 0 0
/dev/ubdc /datadisk ext3 defaults 1 1
/dev/ubdd /altroot ext3 ro 1 1

For me that means I could (in multi-user mode) do the following:
# umount /altroot
# fsck /dev/ubdd
fsck 1.34 (25-Jul-2003)
e2fsck 1.34 (25-Jul-2003)
/dev/ubdd: clean, 37991/82080 files, 112009/163840 blocks
# mount /altroot

If I wanted to check the root disk...
# fsck /dev/ubda
fsck 1.34 (25-Jul-2003)
e2fsck 1.34 (25-Jul-2003)
/dev/ubda is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? no

check aborted.

I'd have to boot single user to do this properly :-)

Hope this helps!

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Wed May 19, 2004 6:52 am 
Offline
Newbie

Joined: Tue May 18, 2004 9:32 am
Posts: 4
Okay, so I guess my main problem still is I'm not sure how to log into my console? I can't get into my Linode with the normal 'ssh root@000'. So this is why I've tried to login via Lish, which works all swell and stuff.

So I'm in a session of my Linode via Lish, and I'm trying to run 'fsck.ext3 /dev/ubda' Here's what I get:

Code:

sh-2.05b# fsck.ext3 /dev/ubda
e2fsck 1.34 (25-Jul-2003)
modprobe: Can't open dependencies file /lib/modules/2.4.26-linode28-1um/modules.dep (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.26-linode28-1um/modules.dep (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.26-linode28-1um/modules.dep (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.26-linode28-1um/modules.dep (No such file or directory)
fsck.ext3: No such file or directory while trying to open /dev/ubda

The superblock could not be read or does not describe a correct ext2filesystem.  If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock:   
e2fsck -b 8193 <device>



So is my disk f'ed? I'm just confused.


Top
   
 Post subject:
PostPosted: Wed May 19, 2004 7:01 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
yo-yo wrote:
sh-2.05b# fsck.ext3 /dev/ubda
[ snip ]
fsck.ext3: No such file or directory while trying to open /dev/ubda


Can you do an "ls -l /dev/ubda" ?
It should look something like:
brw-rw---- 1 root disk 98, 0 Nov 22 19:29 /dev/ubda

If this entry doesn't exist then that could explain your problems. In this case I would do as Chris suggested and deploy a second small distro. This will allow you to fsck the disk and if /dev is broken on your existing image then you can rebuild it

_________________
Rgds

Stephen

(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Wed May 19, 2004 7:47 am 
Offline
Newbie

Joined: Tue May 18, 2004 9:32 am
Posts: 4
okay, thanks! using debian worked. so /dev is missing and broken on my system, how do I go about fixing it?


Top
   
 Post subject:
PostPosted: Wed May 19, 2004 10:19 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
yo-yo wrote:
okay, thanks! using debian worked. so /dev is missing and broken on my system, how do I go about fixing it?

After you've fsck'd the partition in your debian instance, mount it somewhere temporary
eg
# mkdir /a
# mount /dev/udbc /a

Now look in /a/dev - if this is totally bad you could try
# mv /a/dev /a/dev.broken
#
# ( cd / && tar cf - dev ) | ( cd /a && tar xfp - )

This will copy the debian /dev tree over to your broken area.

You can check this with "ls /a/dev"

Unfortunately, if /dev is broken then there <i>might</i> be other damage to the filesystem (other missing files, programs, configurations). You might be better off rescuing the data and setups and rebuilding the image from scratch, just to be safe.

_________________
Rgds

Stephen

(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Wed May 19, 2004 2:49 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
The entire /dev is missing? I hope this wasn't a Gentoo system with devfs, since /dev/ubda is really /dev/ubd/0.

-Chris


Top
   
 Post subject:
PostPosted: Thu May 20, 2004 2:16 am 
Offline
Newbie

Joined: Tue May 18, 2004 9:32 am
Posts: 4
oops.

guess maybe I should have stated that from the beginning. Yep, I've been using Gentoo for all of four days, so pretty darn new at it.

Oh, and when I said my /dev was missing, that was a typo. I meant /dev/ubda was missing, which caker has explained away.

all seems well now. sorry for the trouble!

:oops:


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group