LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-18-2008, 10:32 AM   #1
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
How do I start slackware without mounting drives, but have drives accessible?


Hi all,

This is a basic question, but I'm stumped. I'd like to run fsck on the drive I use to run Slackware. All the advice I've read is to not run fsck on a mounted drive.

So how do I start fsck on my drive without mounting it? I can boot from the Slackware 12.1 installation CD, but that won't read the fstab.

Any suggestions?

Thanks,

-Drew
 
Old 08-18-2008, 10:41 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Is there a reason to run fsck? You can force a filesystem check upon a reboot if necessary. Usually you can run manually by booting into single user mode and or passing init=/bin/bash at the lilo prompt.

To force a filesystem check (fsck) upon reboot, just pass the -F option when rebooting:

/sbin/shutdown -F -r now
 
Old 08-18-2008, 10:42 AM   #3
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
You just need to boot the Slackware installation CD/DVD (or really, any live CD) and run fsck against the device itself.

So if your normal system is mounting /dev/hda1 as /, and you want to check that, you just boot up to a live media and run "fsck /dev/hda1". The device nodes are going to be the same regardless; fstab has nothing to do with it.

Though if you use a live CD other than the Slackware install CD, you will have to pay a little more attention as many distributions are using the new ATA driver which addresses even PATA devices as sdX. So what is called /dev/hda1 under the default Slackware kernel would be /dev/sda1 under a newer kernel.
 
Old 08-18-2008, 11:46 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

You could boot your installed filesystem and pass the 'single' parameter to the kernel. Then perform the 'fsck' on the desired filesystem. As others have pointed out a Livecd or the Slackware install cd/dvd can be used to perform the 'fsck' on the filesystem.

You should 'man fsck';

Code:
excerpt from 'man fsck';

       fsck - check and repair a Linux file system

SYNOPSIS
       fsck  [  -sAVRTMNP  ] [ -C [ fd ] ] [ -t fstype ] [filesys ... ] [--] [
       fs-specific-options ]

DESCRIPTION
       fsck is used to check and optionally repair one or more Linux file sys-
       tems.   filesys  can  be  a device name (e.g.  /dev/hdc1, /dev/sdb2), a
       mount point (e.g.  /, /usr, /home), or an ext2 label or UUID  specifier
       (e.g.   UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).  Nor-
       mally, the fsck program will try to  handle  filesystems  on  different
       physical  disk  drives  in  parallel to reduce the total amount of time
       needed to check all of the filesystems.

       If no filesystems are specified on the command line, and the -A  option
       is  not  specified,  fsck  will  default  to  checking  filesystems  in
       /etc/fstab serially.  This is equivalent to the -As options.
You can do a 'LINUX MAN PAGES ONLINE '. Look at the 'Linux Newbie Admin Guide' for good online reference.

These links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 08-18-2008, 01:05 PM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Just to clarify a bit, when your normal system first boots, the / partition is mounted read-only at first. Then the FORCEFSCK is done. If this variable is set then the / drive will be checked. Then, shortly afterwards it gets remounted read-write ( /sbin/mount -w -v -n -o remount / )and the init processes continue.

You can see all this happening in the first 100 lines, or so, of /etc/rc.d/rc.S -except for the initial mounting of /, which is done by the kernel itself(using the mount options you pass to the kernel with the bootloader. (The last thing the kernel does after uncompressing itself into RAM, is to mount the specified / partition and then turns control over to /sbin/init).

If you boot passing the 'single' option, or after a normal boot-up you pass 'telinit 1' from the terminal, all processes are killed and networked drives are unmounted (see /etc/rc.d/rc.K for this). If you want to fsck your / partition from here, be sure to make sure it is mounted read-only first by running the 'mount' command without options. If it is already mounted read-write, then you can remount it read-only with this command: '/sbin/mount -r -v -n -o remount /'
It's safe then to be fsck'd. If it was already mounted read-write, the partition is probably not greatly damaged. If a drive is so damamged that it can't even be mounted during bootup, then your only recourse is to boot from a CD or other removable device and run fsck on the drive directly without mounting it at all.
 
Old 08-18-2008, 02:22 PM   #6
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180

Original Poster
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Thanks, everyone, for the help.

I've had a couple of hard restarts. I use the JFS file system and I get a message on startup that JFS is "replaying the file system journal" (or something similar), but I feel that a file system check is a good idea. I think I need to use jfs_fsck rather than the normal fsck.

I was unaware that telinit 1 followed by remounting read-only would accomplish what I needed. I'll give passing the "single" parameter via the LILO prompt a try too. If I pass the single parameter, would I still need to remount the root partition with
Code:
/sbin/mount -r -v -n -o remount /
?

Thanks,

-Drew
 
Old 08-18-2008, 10:20 PM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Quote:
Originally Posted by Lufbery View Post
Thanks, everyone, for the help.

I've had a couple of hard restarts. I use the JFS file system and I get a message on startup that JFS is "replaying the file system journal" (or something similar), but I feel that a file system check is a good idea. I think I need to use jfs_fsck rather than the normal fsck.

I was unaware that telinit 1 followed by remounting read-only would accomplish what I needed. I'll give passing the "single" parameter via the LILO prompt a try too. If I pass the single parameter, would I still need to remount the root partition with
Code:
/sbin/mount -r -v -n -o remount /
?

Thanks,

-Drew
If you don't specify the filesystem the 'fsck' will check serially to find the correct filesystem type. See the excerpt below;

Code:
excerpt from 'man fsck'
NAME
       fsck - check and repair a Linux file system

SYNOPSIS
       fsck  [  -sAVRTMNP  ] [ -C [ fd ] ] [ -t fstype ] [filesys ... ] [--] [
       fs-specific-options ]

DESCRIPTION
       fsck is used to check and optionally repair one or more Linux file sys-
       tems.   filesys  can  be  a device name (e.g.  /dev/hdc1, /dev/sdb2), a
       mount point (e.g.  /, /usr, /home), or an ext2 label or UUID  specifier
       (e.g.   UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).  Nor-
       mally, the fsck program will try to  handle  filesystems  on  different
       physical  disk  drives  in  parallel to reduce the total amount of time
       needed to check all of the filesystems.

       If no filesystems are specified on the command line, and the -A  option
       is  not  specified,  fsck  will  default  to  checking  filesystems  in
       /etc/fstab serially.  This is equivalent to the -As options.

       The exit code returned by fsck is the sum of the following conditions:
    0    - No errors
            1    - File system errors corrected
            2    - System should be rebooted
            4    - File system errors left uncorrected
            8    - Operational error
            16   - Usage or syntax error
            32   - Fsck canceled by user request
            128  - Shared library error
       The exit code returned when multiple file systems are  checked  is  the
       bit-wise OR of the exit codes for each file system that is checked.

       In  actuality,  fsck  is simply a front-end for the various file system
       checkers (fsck.fstype) available under Linux.  The file system-specific
       checker  is  searched for in /sbin first, then in /etc/fs and /etc, and
       finally in the directories listed in  the  PATH  environment  variable.
       Please  see  the  file system-specific checker manual pages for further
       details.
You can work on the device directly.
 
Old 08-19-2008, 02:36 AM   #8
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
You'll have to check, but I think that if you pass the 'single' option at boot-time your / partition will not get mounted read-write.
 
Old 08-19-2008, 07:01 AM   #9
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180

Original Poster
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Gilbert, I'm not sure how things worked out with passing the "single" option at boot. I think that the / partition was mount rw instead of ro. Remounting read-only worked just fine and the jfs_fsck took only seconds to complete.

Thanks again, everyone, for your help.

Regards,
-Drew
 
Old 08-19-2008, 11:27 AM   #10
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Yeah, I hadn't tried the single option myself, so I was unsure whether rc.K would be run *after* rc.S or *instead* of rc.S. If it is run after, then the / partition would have already been remounted read-write. A close look at the boot messages would tell you since the remount command is accompanied by a message.
 
Old 08-19-2008, 05:06 PM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

The 'single' boot parameter that you pass to the inet process provides a means to instruct the init to boot the computer in a single user mode. The init does not launch all the usual daemons.

Therefore you can maintain the system in a fashion without the worry of other users on the system. As root you can then perform maintenance on the system without conflict(s). You can perform the 'fsck' without the worry of r/w to the filesystem you are going to be working on by another user.

Another good one you should be aware of is the 'panic=n'. You can use 'panic=15' to provide a means to recover from a kernel problem. The 'panic=15' provides a delay of 15 seconds or whatever you pass for the parameter then the kernel will reboot after the defined time period. Usually the kernel panic will cause a fault that will require a cold boot.


You could look at the 'Linux Kernel in a Nutshell' to get a lot of helpful information.

EDIT: Look at chapter 9

This link and others are available from 'Slackware-Links'. More than just SlackwareŽ links!

Last edited by onebuck; 08-19-2008 at 05:12 PM. Reason: grammar
 
Old 08-21-2008, 07:42 AM   #12
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180

Original Poster
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Thanks, Gary.
 
Old 08-22-2008, 12:05 AM   #13
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Your welcome!

How did the problem work out for you?
 
Old 08-22-2008, 07:00 AM   #14
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180

Original Poster
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by onebuck View Post
Hi,

Your welcome!

How did the problem work out for you?
Things worked out well. After running jfs_fsck, the problems I had with KDE after a couple of hard shut downs cleared up.

Regards,

-Drew
 
Old 08-22-2008, 01:19 PM   #15
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
For future reference, this would have done what you wanted:
Code:
touch /etc/forcefsck
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
2 hard drives, XP on my main sata drives, 10.2 on my IDE LILO doesnt show on boot up Dachy Slackware 14 01-03-2008 07:01 AM
Give user permission to mount/use cdrom drives or usb drives zwyrbla Linux - Newbie 2 08-23-2004 04:30 PM
making mounted drives accessible to user pablowablo Linux - Newbie 7 07-27-2004 04:42 PM
Mounting mounting extended partition and its Logical drives desbyleo Linux - Newbie 10 02-18-2002 03:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration