Date: Sun, 06 Jul 2003 10:03:13 -0400 From: Bill Moran <wmoran@potentialtech.com> To: akanwar@digitarchy.com Cc: freebsd-questions@freebsd.org Subject: Re: running fsck on root filesystem Message-ID: <3F082C21.2000804@potentialtech.com> In-Reply-To: <157240-2200370694639241@M2W071.mail2web.com> References: <157240-2200370694639241@M2W071.mail2web.com>
next in thread | previous in thread | raw e-mail | index | archive | help
kanwar@digitarchy.com wrote: > Hi Bill, > > Thanks for a good reply. Please see my replies inline. > > akanwar@digitarchy.com wrote: > >>I have a remote machine on whose boot disk I want to run fsck. Is there any >>way of booting freebsd form the network and then getting into fixit mode >>without a cdrom or a floppy ? >> >>I am using pxeboot so far. What is happening is that when I put >>"installFixitHoloShell" in the install.cfg then sysinstall throws me to the >>shell that is VERY barebones. I can't run even a 'ls'. In this case how do >>I figure out what disk slices I have in the system and on which I want to >>run fsck ? > > A lot you don't say here. One thing is _why_ you want to do this. Another > is what you want to do. Your description is pretty vague. > > ---* Sorry I erred on the side of being laconic. Here is the situation: I > have a file in /usr/something/file. Whenever I try to cp it to any other > location, the machine freezes! I have tried a tar on the file (machine > freezes) and a cat filename (same result). Here is a truss on the copy This doesn't sound good. Make sure you are getting good backups. > rack1-104.sjc# truss cp ft-v05.2003-06-30.104501-0700 /tmp > stat("/tmp",0xbfbffb90) = 0 (0x0) > umask(0x1ff) = 18 (0x12) > umask(0x12) = 511 (0x1ff) > readlink("/etc/malloc.conf",0xbfbff984,63) ERR#2 'No such file or > directory' > mmap(0x0,4096,0x3,0x1002,-1,0x0) = -2012909568 (0x88057000) > break(0x806b000) = 0 (0x0) > break(0x806c000) = 0 (0x0) > break(0x806d000) = 0 (0x0) > break(0x806e000) = 0 (0x0) > stat("ft-v05.2003-06-30.104501-0700",0x806d160) = 0 (0x0) > stat("/tmp/ft-v05.2003-06-30.104501-0700",0xbfbffa84) ERR#2 'No such file > or directory' > open("ft-v05.2003-06-30.104501-0700",0x0,00) = 3 (0x3) > open("/tmp/ft-v05.2003-06-30.104501-0700",0x601,0100644) = 4 (0x4) > mmap(0x0,5941955,0x1,0x1,3,0x0) = -2012905472 (0x88058000) > <dies> > > If I do a cat here is what happens: > > rack1-104.sjc# truss cat ft-v05.2003-06-30.104501-0700 > /dev/null > open("ft-v05.2003-06-30.104501-0700",0x0,00) = 3 (0x3) > fstat(1,0xbfbffb30) = 0 (0x0) > readlink("/etc/malloc.conf",0xbfbffa90,63) ERR#2 'No such file or > directory' > mmap(0x0,4096,0x3,0x1002,-1,0x0) = -2012909568 (0x88057000) > break(0x805a000) = 0 (0x0) > break(0x805b000) = 0 (0x0) > read(0x3,0x805a000,0x1000) = 4096 (0x1000) > write(1,0x805a000,4096) = 4096 (0x1000) > read(0x3,0x805a000,0x1000) = 4096 (0x1000) > write(1,0x805a000,4096) = 4096 (0x1000) > read(0x3,0x805a000,0x1000) = 4096 (0x1000) > write(1,0x805a000,4096) = 4096 (0x1000) > read(0x3,0x805a000,0x1000) = 4096 (0x1000) > write(1,0x805a000,4096) = 4096 (0x1000) > read > <dies> > > At this point the machine stops responding to any console or network > connections. After a while it spews ethernet flow control frames, > indicating that the interrupts from the NIC to the kernel are not being > serviced. > > I did a memory check on the box and it looks ok. So now I suspected the > disk...and was looking for a good way to test it. I think you're already testing it. > fsck is always run on the root filesystem at boot time, in preen mode. > If you're having some sort of filesystem errors, setting fsck_y_enable="YES" in > /etc/rc.conf will cause the startup scripts to automatically run 'fsck -y' if > fsck fails in preen mode. > > ---* This is a good suggestion. I need to run it on the /usr slice though. fsck is run on all filesystems that are listed in /etc/fstab during boot. > From any shell, you should be able to mount filesystems readonly. When > mounted readonly, you can safely run fsck. Use 'mount -r /mountpoint'. Many > of your commands are not on the root filesystem, so you may need to mount > (for example) /usr before you can execute certain commands. > > ---* Problem: here is the fstab: > # Device Mountpoint FStype Options Dump > Pass# > /dev/ad0s1a / ufs rw 1 1 > /dev/ad0s1f /tmp ufs rw 2 2 > /dev/ad0s1g /usr ufs rw 2 2 > ... > > When I get to the shell (via sysinstall), I do What do you mean "via sysinstall"? Will the machine not boot? Since this is the /usr partition, there's nothing magical required. Boot the system normally. Then shut down all processes that might access /usr and be sure all files on /usr are closed. Then: umount /usr fsck -yf /dev/ad0s1g Repeat the fsck until it completes without reporting any errors. Then 'mount /usr' and check to see if you can access the file correctly. If you have trouble getting /usr unmounted, reboot the system. At the countdown press space, then enter 'boot -s' and hit enter. When asked for the shell, hit enter. You're now in "single-user" mode, and /usr isn't mounted, so you can surely do 'fsck -yf /dev/ad0s1g'. -- Bill Moran Potential Technologies http://www.potentialtech.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F082C21.2000804>