LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 06-29-2009, 11:20 PM   #1
booberandpuzz
Member
 
Registered: Apr 2008
Location: South Florida, USA
Distribution: Ubuntu 8.04
Posts: 32

Rep: Reputation: 15
fstab entries for removable hard drives


As proof I'm still relatively inexperienced, I booted my Ubuntu 8.04 fileserver without two drives that normally reside in a four-bay hot-swap SATA device and then spent two days trying to figure out why I was getting dropped to the shell with instructions to "manually repair filesystem." I finally realized that simply replacing the two missing drives resolved the problem.

Anyway, I have no real need to use the actual hot-swap ability, but I do want to be able to change drives around as needed (with the machine turned off) without different configurations causing a problem on boot up.

I have UUID entries for all HDDs in the fstab:

Code:
# /dev/sda1
UUID=xxxxxxxxx / ext3    relatime,errors=remount-ro 0       1

# /dev/sda5
UUID=xxxxxxxxx none      swap    sw              0       0

# /dev/scd0
/dev/scd0   /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

# /dev/sdb1
UUID=xxxxxxxxx /mnt/sdb1  ext3    defaults         1       2

# /dev/sdc1
UUID=xxxxxxxxx /mnt/sdc1  ext3    defaults         1       2

# /dev/sde1 THIS IS REMOVABLE DRIVE
UUID=xxxxxxxxx /media/sde1 ext3    defaults,relatime    0       2

# /dev/sdd1 THIS IS REMOVABLE DRIVE
UUID=xxxxxxxxx /media/sdd1 ext3    defaults,relatime    0       2
Drives sda, sdb, and sdc are "permanent" while sdd and sde are removable.

I'd like to configure the fstab such that the system will mount removable drives it recognizes when they're present, but not stumble when they're not.

Any advice appreciated!
 
Old 06-30-2009, 12:37 AM   #2
explodingzebras
Member
 
Registered: Oct 2007
Location: UK
Distribution: Ubuntu
Posts: 63

Rep: Reputation: 18
Try changing "UUID=xxxxxxxxx /media/sdd1 ext3 defaults,relatime 0 2" to
"/dev/sdd1 /media/sdd1 ext3 defaults,relatime 0 2" and the similar with the other drive. I found this my ubuntu server didn't complain recently when i removed a hdd mounted in this way.
 
Old 06-30-2009, 12:17 PM   #3
booberandpuzz
Member
 
Registered: Apr 2008
Location: South Florida, USA
Distribution: Ubuntu 8.04
Posts: 32

Original Poster
Rep: Reputation: 15
Will this approach bungle the fact that one of the physical drives needs to always be sdd and the other sde? Reversing that will screw me up. How will the system assign the dev names?
 
Old 06-30-2009, 12:43 PM   #4
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
I would keep the UUID, but add the noauto option. This will keep it from mounting at boot. Of course, then you may have to manually mount each drive if hal or udev don't take care of it automagically.

I believe you can edit either HAL or udev config files to make it automount if plugged in, but I haven't messed with that.
 
Old 06-30-2009, 06:38 PM   #5
booberandpuzz
Member
 
Registered: Apr 2008
Location: South Florida, USA
Distribution: Ubuntu 8.04
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks!

As in:

Code:
UUID=xxxxxxxxx /media/sdd1 ext3    defaults,relatime,noauto    0       2
Thanks! I just want to keep my mount points segregated by UUID so that no physical drive ever pretends to be another ... and without confusing the boot up. I've got 26 letters to work with, right? Up to /dev/sdz1
 
Old 06-30-2009, 06:43 PM   #6
booberandpuzz
Member
 
Registered: Apr 2008
Location: South Florida, USA
Distribution: Ubuntu 8.04
Posts: 32

Original Poster
Rep: Reputation: 15
Could I also execute a simple script that goes something like,

Code:
IF EXISTS UUID=xxxxxxxxx
      THEN MOUNT  (blah blah)
rather than mess with the strange and unknown (to me) HAL or udev?
 
Old 06-30-2009, 06:49 PM   #7
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
Probably. I'm lazy, I would just type mount /media/sdd1 and be done with it...
 
Old 06-30-2009, 09:22 PM   #8
booberandpuzz
Member
 
Registered: Apr 2008
Location: South Florida, USA
Distribution: Ubuntu 8.04
Posts: 32

Original Poster
Rep: Reputation: 15
You know, in this case I think lazy is good, because it's also simple. At my level of expertise, I need to keep things as simple as I can. I appreciate your advice.
 
Old 07-01-2009, 12:03 PM   #9
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
No problem. Oh yeah, if you also add the "user" option to fstab you can even mount it as your normal user. Although I think you have to have rw access to the mount point.
 
Old 07-01-2009, 01:08 PM   #10
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
How will the system assign the dev names?
This (and more) is handled by udev.

I suggest you take a quick read through how to write udev rules:
http://www.reactivated.net/writing_udev_rules.html
because one day you'll need a udev rule, and if you don't know about them, or appreciate the concept ... .. .
 
  


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
Help editing fstab to mount hard drives ChootarLaal Ubuntu 22 03-08-2008 03:43 PM
Mount removable disk without root access and fstab entry - possible? FogSwimmer Linux - Hardware 2 08-31-2007 07:41 PM
HotPlugging IDE hard drives on internal removable bay mauryr Linux - Hardware 4 02-28-2007 02:13 PM
How to repair FStab after changin hard drives? Anjin Mandriva 4 03-22-2005 04:04 AM
what entries to put into fstab for new hard disk? chuck_notorious Linux - Hardware 1 04-21-2004 04:37 AM


All times are GMT -5. The time now is 03:51 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