LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-09-2012, 04:45 AM   #1
nickhoare
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Rep: Reputation: Disabled
fsck and fstab explanation sought


We use drbd and I need to fsck the drbd volume. I thought I new the drbd partition name but looking in fstab it did not appear. I could not mount it. I tried fsck and that was able to see the partition.

The fsck manual says it looks in fstab but it must be looking somewhere else to find partitions. Where does it look? There is an entry in /dev/disk/by-id for this partition. Is fsck looking there?

A secondary question is whether I need to fsck the Secondary drbd image on the other server, as well, but I am still investigating that.

Last edited by nickhoare; 08-10-2012 at 03:14 AM. Reason: Make title more relevant to thread
 
Old 08-09-2012, 08:56 AM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,943
Blog Entries: 5

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
Exactly what command line did you type that did the fsck of the device? What output did you get that tells you it did the fsck of the one you're interested in? (That is did you type just "fsck" or "fsck -A" or "fsck /dev..."?)

With fsck you can specify the device to check so would not need to read /etc/fstab if you did this. (In fact this is the most common usage at command line - most fsck's are done at boot instead.)

After a filesystem is mounted it appears in /etc/mtab (this file should NOT be edited manually).

However, in general it is a bad idea to run an fsck on a mounted filesystem - you should first unmount it.
 
1 members found this post helpful.
Old 08-09-2012, 10:46 AM   #3
nickhoare
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Smile

I typed fsck -n /dev/sda9 . I was unable to mount using "mount /dev/sd9" but have since discovered that "mount /dev/sda9 /mnt" works I presume because I am telling mount where to mount it and so it can manage without an entry in fstab?

My understanding of fstab is now that it is a list of normally mounted partitions (filesystems?), used e.g on boot, whereas I originally thought it was a list of all available partitions. /etc/mtab has a list of currently mounted partitions . There may be other partitions not appearing in fstab. All partitions can be found in /dev/disk ?

I think fsck warns about mounted filesystems. I was able to run fsck on my unmounted volume and repair it. There is now a mass of files in a folder lost+found yet everything works, which is disconcerting.

Thanks for your help
 
Old 08-09-2012, 12:04 PM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,943
Blog Entries: 5

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
The mount (and umount) commands will read /etc/fstab to find information you didn't supply at command line. If you had the entry in /etc/fstab for /dev/sda9 to mount it somehwere (e.g /mnt) and also had any filesystem specific options in that file then when you typed "mount /mnt" it would read fstab and know you meant to mount /dev/sda9 as /mnt and also use any options you'd put in fstab as if you'd typed them with the mount command.

Of course typically you wouldn't want to use "/mnt" by itself in /etc/fstab. Not that you can't but that it would not be coventional - people typically use /mnt (or subdirectories thereof) for temporary mounts. If you're putting it in /etc/fstab you should probably create a mount point (empty directory) to mount it. For example if you wanted to access the files on /dev/sda9 in a directory called /my/long/mount/path/mydir and it was an ext4 filesystem you'd:
1) mkdir -p /my/long/mount/path/mydir
2) Add the entry to /etc/fstab that looked something like:
/dev/sda9 /my/long/mount/path/mydir ext4 defaults,_netdev 1 3
3) Type "mount /my/long/mount/path/mydir" to mount it.
If you do ls -l of mydir before the mount you'll see it is empty. After the mount it will have any files you put in it.
As a test you could write to the mount you did in /mnt then do umount /mnt then do the above steps and you'll see the files that were previously in /mnt are now in mydir.

/etc/fstab is read during boot to mount any filesystem that you want to mount statically and automatically. (There is a separate setup called automount in the /etc/auto* files for mounting filesystems on demand temporarily.)

Last edited by MensaWater; 08-10-2012 at 08:07 AM.
 
Old 08-09-2012, 08:33 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
All of the above & in short:
Code:
# show all disks/partitions the system can see
fdisk -l     # lowercase L

# disk/partitions you would LIKE mounted at boot time
cat /etc/fstab

# disks/partitions ACTUALLY currently mounted
cat /etc/mtab

# automount in the /etc/auto* files for mounting filesystems on demand temporarily (MensaWater)
ls /etc/auto*
HTH
 
Old 08-10-2012, 03:21 AM   #6
nickhoare
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for the clear succinct explanation guys. I do RTFM but man documents do not give overviews like yours. And knowing what to google can be a problem if you don't know the terminology.
 
Old 08-10-2012, 08:17 AM   #7
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,943
Blog Entries: 5

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
Quote:
Originally Posted by nickhoare View Post
knowing what to google can be a problem if you don't know the terminology.
You think it is bad in Google! When I first started working on computers one had to rely on actual books (manuals). The first time I needed the database concept of "outer join" I had no clue it was called that and ended up having to read most of an Informix manual just to find that was what it was called. I knew such a concept existed because I'd previously used Paradox to join tables but they didn't call it that. Informix manuals had the worst INDEXES of any manuals I've ever come across which is somewhat ironic given how important INDEXES are to a DBMS.

When I was in school (not long after the dinosaurs roamed the earth) they regularly taught us how to search for books in card catalogs and how to find information in them in indexes in the back of the books and various other ways to find information from periodicals and such. With the advent of web searches I wonder if they bother teaching that any longer.

 
Old 08-10-2012, 10:18 AM   #8
nickhoare
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Mensa, I remember the days of Technical Manuals! I may have been trying to disguise myself as a youngster, but in fact I carry a lot of historical baggage from DEC VMS, DBMS, ORACLE, through Windows, Netware, VB, SQL Server, ASP.NET and now have lumbered myself with something else new. Did I mention Delphi, C++ and dBase?

At least with manuals you only had one place to look.....
 
Old 08-10-2012, 11:03 AM   #9
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,943
Blog Entries: 5

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
Ah dBase II I remember it well but not fondly. Paradox was a superior product until Borland merged dBase and Paradox together to make them indistinguishable later. Funny thing about dBase II - There never was a dBase I - they named it II to make it sound more advanced. Up until M$ started giving away Access most folks with PCs who needed a DB used dBase or Paradox (or some other oddities like Foxpro).

When I first started working on PCs it was the original IBM PC with 4.7 MHz processor, DOS 2.0 and Lotus 123 v1.A. DOS 2.0 was fun because if you were sitting on your C drive and typed "format" it didn't ask if you really meant to format C - it just went ahead and did it. D'oh!

Oddly enough I've worked with IBM System 34/36, NetWare, multiple flavors of UNIX (including odd ones like Qnix, Apple's early one called A/UX, Dynix and DEC's Astrix. Despite that the only place I ever saw the Alphas was at my present job and they decommissioned them shortly after I got here. As common as they were it always amazed me I never seemed to be anywhere where they were.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Running fsck At Boot On Partitions Not In fstab Woodsman Slackware 5 11-27-2009 01:28 PM
[SOLVED] Help Edit the /etc/fstab specifically the dump and fsck options jollibee Linux - Newbie 3 07-16-2009 11:30 PM
Explanation sought for a check in ip_finish_output2() function Pankaj Srivastava Linux - Networking 0 05-24-2007 08:52 PM
How to run FSCK and error in FSTAB kc5hwb Ubuntu 5 04-12-2007 11:50 AM
Your /ect/fstab does not contain the fsck passno field LostinCode Mandriva 3 05-07-2004 03:15 PM


All times are GMT -5. The time now is 05:02 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration