LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-02-2009, 04:15 PM   #16
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19

Quote:
Originally Posted by stress_junkie View Post
I'm running Kubuntu. The sudoers file has several examples. If you look at those and then look at the entry that you created it should be evident how your entry does not conform to the syntax.


Nevertheless the better approach is to create entries in the /etc/fstab file to automatically mount disk partitions at boot time.


What are the device mappings to the disk partitions that are not working? (/dev/sda1, /dev/hdc4, ???)

The basic syntax of /etc/fstab entries are as follows:

<device> <mnt-point> <file-type> <mount-params> <frequency> <fsck>

An example entry is as follows:

/dev/sda3 /mnt/sda3 auto auto,defaults 0 0

I seem to have stumbled on a problem that has sparked interest!! I thank everyone so far for your efforts.

I would far rather get the whole fstab thing right as this appears to be the 'proper' way to do things. I have done this sucessfully in PCLOS in the past with no issues, but it would appear that Kubuntu has a whole different way of working (or not!).

On the whole I much prefer my current Kubuntu 8.10 to my old PCLOS07, mainly because I'm a sucker for eye candy and neat tricks, which KDE4/Plasma has oodles of.

In an ideal world I would like to set up my drives as they were in PCLOS. I have several drives which I want mounted inside my home dir (Music, Documents, Video etc) as I am a bit of a media hoarder so keeping all this in one drive is just not practical. I was advised by someone a little while back this was not wise and to try mounting into /media. I did a comprehensive re-write of my fstab with UUID's etc and annotated everything for easy reference later, created the mount points I had allocated to each drive, re-booted and nothing happened, none of my drives (other than root and swap) mounted.

The other big issue I have is that even when manually mounted, I cannot write to any of these 'outlaw' drives. One is NTFS (left over from my last MS instal a couple of years ago) one is ext2 one is ext3 - same hassle with all of them.

If anyone can steer me out of this, I'll be VERY grateful!!
 
Old 03-02-2009, 06:24 PM   #17
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by PClOStinspace View Post
I would far rather get the whole fstab thing right as this appears to be the 'proper' way to do things. I have done this sucessfully in PCLOS in the past with no issues, but it would appear that Kubuntu has a whole different way of working (or not!).
The style of using UUID instead of /dev/<device> is completely optional. You can mix and match as you see fit. You can use the same format/syntax that you used in PCLOS.
Quote:
Originally Posted by PClOStinspace View Post
In an ideal world I would like to set up my drives as they were in PCLOS. I have several drives which I want mounted inside my home dir (Music, Documents, Video etc) as I am a bit of a media hoarder so keeping all this in one drive is just not practical. I was advised by someone a little while back this was not wise and to try mounting into /media. I did a comprehensive re-write of my fstab with UUID's etc and annotated everything for easy reference later, created the mount points I had allocated to each drive, re-booted and nothing happened, none of my drives (other than root and swap) mounted.
Here is some example code. This is the way that I do it. It may seem a little bit more complex than is required but it may appeal to you.
If the music is on /dev/sda5 which you want mounted on /home/jim/music and the pictures are on /dev/sda8 which you want it mounted on /home/jim/pics then this would be the way my fstab would read:
Code:
/dev/sda5 /mnt/sda5 auto auto,defaults 1 1
/mnt/sda5 /home/jim/music auto bind,auto,user,users,uid=jim,gid=users 0 0

/dev/sda8 /mnt/sda8 auto auto,defaults 1 1
/mnt/sda8 /home/jim/pics auto bind,auto,user,users,uid=jim,gid=users 0 0
Quote:
Originally Posted by PClOStinspace View Post
The other big issue I have is that even when manually mounted, I cannot write to any of these 'outlaw' drives. One is NTFS (left over from my last MS instal a couple of years ago) one is ext2 one is ext3 - same hassle with all of them.
The NTFS drive should be mounted as an ntfs-3g type drive. Here is the manual command to mount it if it is /dev/sda3 and you want to mount it on /mnt/sda3.
Code:
mount -t ntfs-3g -o rw /dev/sda3 /mnt/sda3
The following is the fstab record for it.
Code:
/dev/sda3 /mnt/sda3 ntfs-3g auto,defaults 0 0
If it is then owned by root you can, once it is mounted, use this command. You only have to do this once.
Code:
chown -c root:users /mnt/sda3
chmod -c 770 /mnt/sda3
This last bit also applies to your ext2 and ext3 partitions.
Quote:
Originally Posted by PClOStinspace View Post
If anyone can steer me out of this, I'll be VERY grateful!!
Let's hope I got all of the details correct. I know the procedure is correct because I've done it many times.

Last edited by stress_junkie; 03-02-2009 at 06:31 PM.
 
Old 03-02-2009, 06:35 PM   #18
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Thanks SJ, I'll be have another stab at fstab tomorrow and let you know how it goes!!
 
Old 03-02-2009, 06:37 PM   #19
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
These are all internal drives?
You want them mounted at boot time? Or just when you log in?

To get fstab doing this, you want to post your existing fstab and the output of fdisk -l - then the steps will be unambiguous.

You can assign uuids so when you change drives you don't mess up the mounts. But, the standard fstab entry for a user accessible partition would be:

/dev/sda6 /media/music-drive auto defaults,rw 0 0

to follow:

mount /dev/sda6 /media/music-drive -o rw

so getting the manual mount to work will give you the fstab line.

using /media is a discipline which can help in subtle ways. If you want this to be accessed from ~/music, then you can bind (see mount(8)) the mountpoint there or use a link.

Note: ntfs is different - use "ntfs-3g as the filesystem in fstab and ntfs-3g command manually.


The workaround would be to use the mount command (with options to make the filesystem rw and owner) in a script set to run at login. Then you needn't worry about needing to use sudo.

Last edited by Simon Bridge; 03-02-2009 at 07:34 PM.
 
Old 03-02-2009, 06:48 PM   #20
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by Simon Bridge View Post
These are all internal drives?
You want them mounted at boot time? Or just when you log in?

To get fstab doing this, you want to post your existing fstab and the output of fdisk -l - then the steps will be unambiguous.
gregg@kubuntu:~$ fdisk -l
Cannot open /dev/sda
Cannot open /dev/sdb
Cannot open /dev/sdc
Cannot open /dev/sdd
Cannot open /dev/sde

Current fstab:-

proc /proc proc defaults 0 0
UUID=d3bfd134-3305-4310-b854-f356eff9d2f8 / ext3 relatime,errors=remount-ro 0 1
UUID=093ce5e2-a5b6-46e9-9218-f78dfcaa460c none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
 
Old 03-02-2009, 07:13 PM   #21
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
This thread turns out to be more interesting that at first sight. For those joining us - the nature of FOSS is that an innocent question can turn out to have implications beyond what the original questioner suspected. The nature of community based support is that members are free to provide information and advise which the questioner needs (and the community would prefer) rather than, nessisarily, what they want. Discussing these things, including clarifications and the odd argument, is normal and healthy.

Quote:
Originally Posted by stress_junkie
/dev/sda5 /mnt/sda5 auto auto,defaults 1 1
man mount gives:
Code:
defaults
    Use default options: rw, suid, dev, exec, auto, nouser, and async.
"auto" is included in "defaults". It makes no functional difference - however, including only option which are used is like wiring a plug to the color code: it has nothing to do with electricity and everything to do with helping someone else troubleshoot later. (Not as potentially life-threatening though.)

Quote:
/mnt/sda5 /home/jim/music auto bind,auto,user,users,uid=jim,gid=users 0 0
This line says that any user logged in can mount and unmount the fs. Only useful where you have more than one user logged in.

If you just want to be able to mount and unmount the system as an ordinary user - use "user" (including "user" and "users" on the same line seems odd) - then the mounting user cannot find their music unmounted before they are finished with it. Since you set "auto", users don't need to mount it - this implies that there some circumstances you want users to be able to unmount it.

The general principle here is that: when you get a choice between doing something securely or insecurely, then, ceteris paribus, you do it securely. Even if there is no currently perceived security risk or consequences to trade off.

The line also sets the owner and group of the files to jim and users - so you are sharing the muic with others on your system - if you set permissions to rw-r----- then the owner can modify the files but users con only play them ... nobody else gets a looksee. Reasonable.

Note: "bind" is not an "option" to mount - it is used to remount part of a filesystem tree elswhere not for remounting the whole tree. You can mount the whole tree in several places.

eg - if /dev/sda5 contains directories /music and /video - it may be mounted at /media/multimedia ... but you may use

mount --bind /media/multimedia/music ~/music

to have the music accessed from your home directory.

An interesting trick is to

mount --make-slave mountpoint ~/music

then, when /media/multimedia is unmounted, ~/music is too; but if ~/music is unmounted, it does not unmount /media/multimedia. (Not really relevant to bind use though.)

Quote:
mount -t ntfs-3g -o rw /dev/sda3 /mnt/sda3
.. that works! I had to look it up because it didn't used to ...
man ntfs-3g
Code:
ntfs-3g volume mount_point [-o option[,...]]
mount -t ntfs-3g volume mount_point [-o option[,...]]
IIRC: used to be the first one only would work, though you could always use it in the place of the fs-type in fstab.

ntfs-3g is different from the others in that it is not a file system type nor even a driver (in the usual sense) - it is a utility program allowing ntfs file systems to be mounted using the FUSE interface. However, it is advisable not to use ntfs on general principles.

Current trends in international copyright suggest that any use not granted is denied. Thus, any emerging use will infringe upon the terms of the current license - until new license terms are negotiated. So far we are seeing this (recently) with books, where publishers and licensing agents are claiming that machine-reading a text book infringes upon the copyrights for audio books.

Last edited by Simon Bridge; 03-02-2009 at 07:28 PM.
 
Old 03-02-2009, 07:29 PM   #22
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
gregg@kubuntu:~$ fdisk -l
sudo fdisk -l

A user can only access information owned by them. All those are owned by root.


Last edited by Simon Bridge; 03-02-2009 at 07:31 PM.
 
Old 03-02-2009, 07:43 PM   #23
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by Simon Bridge View Post
This thread turns out to be more interesting that at first sight. For those joining us - the nature of FOSS is that an innocent question can turn out to have implications beyond what the original questioner suspected. The nature of community based support is that members are free to provide information and advise which the questioner needs (and the community would prefer) rather than, nessisarily, what they want. Discussing these things, including clarifications and the odd argument, is normal and healthy.



man mount gives:
Code:
defaults
    Use default options: rw, suid, dev, exec, auto, nouser, and async.
"auto" is included in "defaults". It makes no functional difference - however, including only option which are used is like wiring a plug to the color code: it has nothing to do with electricity and everything to do with helping someone else troubleshoot later. (Not as potentially life-threatening though.)


This line says that any user logged in can mount and unmount the fs. Only useful where you have more than one user logged in.

If you just want to be able to mount and unmount the system as an ordinary user - use "user" (including "user" and "users" on the same line seems odd) - then the mounting user cannot find their music unmounted before they are finished with it. Since you set "auto", users don't need to mount it - this implies that there some circumstances you want users to be able to unmount it.

The general principle here is that: when you get a choice between doing something securely or insecurely, then, ceteris paribus, you do it securely. Even if there is no currently perceived security risk or consequences to trade off.

The line also sets the owner and group of the files to jim and users - so you are sharing the muic with others on your system - if you set permissions to rw-r----- then the owner can modify the files but users con only play them ... nobody else gets a looksee. Reasonable.
I don't know who you are trying to impress. I find your analysis superfluous, pedantic, and pompous.
 
Old 03-02-2009, 09:09 PM   #24
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
I don't know who you are trying to impress. I find your analysis superfluous, pedantic, and pompous.
I don't understand this statement. You are using too many big words ... I had to look them up.

Tell you what: I'll tell you what I found and you can tell me how wrong I am

superfluous - excessive, needless or obsolete?
1. excessive - certainly, though I prefer: exuberant
2. needless - remains to be seen - in you specific case I take it you already knew that you had included redundancies in your fstab entries? Someone else searching/googling to this thread some months after we have all gone may benifit from the discussion. Or, they may agree with you.
3. obsolete - certainly not, the information is current.
... so you must mean 1 or 2, and 1 is the only proper fit - and includes this post. Indeed, much of what I post is superfluous in this sense. Same for anybody.

(Note - your own post had more than 90% superfluous comment - the quoted passage. You did not need to quote the entire passage because it appears directly above post. It is also unhelpful - I cannot tell which part of the post leads you to make these comments and you don't clarify.)

pedantic
1. ostentatious in one's learning.
... hmmm... maybe. It's a tough balance to strike: howdo I go about providing potentially useful information without "showing off" my learning? I had hoped to avoid this by providing references - so anyone could have just looked this stuff up with no special claim to learning justified.
2. overly concerned with minute details or formalisms, esp. in teaching.
... I suspect this is what you mean though. I hoped I had justified each issue in terms of "best practices" and illustrative examples. Presumably you think that if an instruction "just works" then I should not quibble over the form of the instruction?

I used the example of electrical wiring to illustrate the principle - insisting on the legal color code at all times can be considered pedantic - but it is a useful pedantery. Just "making the light work" is not the only thing at stake here.

pompous
1. characterized by an ostentatious display of dignity or importance: a pompous minor official.
2. ostentatiously lofty or high-flown: a pompous speech.
3. characterized by pomp, stately splendor, or magnificence.

... I am having a hard time fitting this to what I've said. Each of the accepted uses require you to be able to see or hear me in some way. It does strike me that I may be writing with a British accent (so to speak)? That can sometimes come across as pompous to an American (and others). It can be hard to get the right tone in text - - - I do apologize.

(Note: your own post fits #2 - but I'm guessing that using these big words just shows how annoyed you are and you are not allowed to swear.)


You have thoughtfully provided examples of your own, working, fstab entries - and I don't want to take away from that. The examples are, without a trace of irony, very useful - especially as they demonstrate common, though subtle, pitfalls. This sort of example is actually more useful than a correct one and I wondered if you had done this deliberately... so you could discuss them. Apparently not.

I had hoped to avoid ad hominem arguments - but I see I'm committing them too. Ah - perhaps its the Latin which looks pompous? I'll help:

ad hominem ... formally, I have used this too, in brackets.
ceteris paribus ... which is important for the security generalization as there are situations which make it untrue.

Latin use does not have to be pompous - though it is a bit show-off-y, but I risk going on ad nausium. I'll provide this link of common latin phrases in English for the reader's perusal ad libirtum.

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur.
 
Old 03-03-2009, 10:18 AM   #25
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
:)

All right Simon. I'm too close to actually laughing to stay angry. As my Latin teacher often said 35 years ago, "Illegitimi non carborundum".
http://en.wikipedia.org/wiki/Illegitimi_non_carborundum
 
Old 03-03-2009, 04:57 PM   #26
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
Even if none of the advice given above helps me (which I doubt as between you both you are giving me the choice of verbose and succinct answers which seem to make sense) I am thoroughly enjoying reading it all.

But really, if we all did things the same it'd be boring. I think SJ likes to do things in a way that 'just works' who cares if theres a bit of superfluos code in there if it's not harming anything, Whereas SB prefers a 'by the book' approach which ensures correctness and accuracy, I respect both your approaches.

Simon, I will be checking out your latin links, they will annoy the pants off my boss. If you need help with wiring lights I'm your man, I'm a lighting designer so the simile was not wasted!!

I have not had time for the great fstab adventure today as I spent all day on a building site.....
....wiring lights (this is totally genuine, I am not taking the p'!) I will hopefully have a go before the weekend and I will report back here.

BTW:-

gregg@kubuntu:~$ sudo fdisk -l
[sudo] password for gregg:

Disk /dev/sda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe3d2bcec

Device Boot Start End Blocks Id System
/dev/sda1 * 1 6994 56179273+ 83 Linux
/dev/sda2 6995 7297 2433847+ 5 Extended
/dev/sda5 6995 7297 2433816 82 Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x9015c0b3

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 19457 156288321 7 HPFS/NTFS

Disk /dev/sdc: 122.9 GB, 122942324736 bytes
16 heads, 63 sectors/track, 238216 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0xaf0eaf0e

Device Boot Start End Blocks Id System
/dev/sdc1 1 24352 12273376+ 82 Linux swap / Solaris
/dev/sdc2 * 24353 238216 107787173 5 Extended
/dev/sdc5 24353 238216 107787172+ 83 Linux

Disk /dev/sdd: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xace22e9e

Device Boot Start End Blocks Id System
/dev/sdd1 1 4648 37335028+ 83 Linux
/dev/sdd2 * 4936 19457 116647965 83 Linux
/dev/sdd3 4649 4935 2305327+ 5 Extended
/dev/sdd5 4649 4914 2136613+ 83 Linux
/dev/sdd6 4915 4935 168651 82 Linux swap / Solaris

Partition table entries are not in disk order


What is the likelihood of any of this output being wrong? I am 90% certain that SDB1 is actually a 200GB drive????
 
Old 03-03-2009, 07:56 PM   #27
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
What is the likelihood of any of this output being wrong?
Extremely unlikely, that's why I insist on seeing it.
Quote:
I am 90% certain that SDB1 is actually a 200GB drive????
Now you know better.

If you like, you can check the manufacturers designation on each drive and compare with this list.

sda is 60gig and dedicated to linux. Interestingly, the swap partition is the entire extended partition - I'm guessing some sort of default installation does this?

sdb is 160gig ntfs in one partition.

check that this mounts with:
ntfs-3g /dev/sdb1 /media/windows

sdc is 122.9 (old drive?) also dedicated to a single distro - this time the partitioning is the other way around.

sdd looks odd:
Code:
/dev/sdd1      1  4648 37335028+ 83 Linux
/dev/sdd2 * 4936 19457 116647965 83 Linux
/dev/sdd3   4649  4935 2305327+   5 Extended
/dev/sdd5   4649  4914 2136613+  83 Linux
/dev/sdd6   4915  4935 168651    82 Linux swap / Solaris
... mostly because of the small-looking extended partition. But it should be fine.

Which were the partitions you wanted to mount?

Quote:
Originally Posted by sj
As my Latin teacher often said 35 years ago, "Illegitimi non carborundum".
Mine would have rapped me across the knuckles

"Noli nothis permittere te terere." ... ah omnia mihi lingua Graeca sunt!

Last edited by Simon Bridge; 03-03-2009 at 07:58 PM.
 
Old 03-07-2009, 06:27 AM   #28
PClOStinspace
Member
 
Registered: Jun 2008
Location: Bracknell, UK
Distribution: Ubuntu 13.10 Saucy
Posts: 152

Original Poster
Rep: Reputation: 19
I'm in the process of re-formatting some of those messy drives now, once I've got them a bit neater, I will re-write that fstb, I'll post my new one along with a new fdisk output before I go the whole hog and actually use it to see if there any obvious whoopsies!

One question before I do though, what do the two digits at the end of each fstab entry mean (the 0 0 or 0 1 or 1 1) I've never known and always just copied them from elsewhere!! I suspect this will be causing problems somewhere. Nothing personal SB, but if you reply, could you use fewer sentences. My brain is a little battered after a hard week at work and I don't think I could cope with a long answer! SJ, if you're reading stop grinning ;-)
 
  


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
parse error in /etc/sudoers near line -1 RAFAL Linux - Newbie 2 11-10-2008 11:56 AM
Line 7 in /etc/fstab is bad!!! Please Help da_xlnc Linux - General 9 07-20-2006 07:03 AM
Line 7 in fstab bad.... cooljed Linux - General 1 01-11-2006 07:42 AM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 06:03 PM
Bad line in fstab dubya Fedora 2 06-19-2005 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration