LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   fstab entries for removable hard drives (https://www.linuxquestions.org/questions/linux-newbie-8/fstab-entries-for-removable-hard-drives-736576/)

booberandpuzz 06-29-2009 10:20 PM

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!

explodingzebras 06-29-2009 11:37 PM

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.

booberandpuzz 06-30-2009 11:17 AM

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?

pljvaldez 06-30-2009 11:43 AM

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.

booberandpuzz 06-30-2009 05:38 PM

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

booberandpuzz 06-30-2009 05:43 PM

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?

pljvaldez 06-30-2009 05:49 PM

Probably. I'm lazy, I would just type mount /media/sdd1 and be done with it...

booberandpuzz 06-30-2009 08:22 PM

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.

pljvaldez 07-01-2009 11:03 AM

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.

tredegar 07-01-2009 12:08 PM

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 ... .. .


All times are GMT -5. The time now is 09:47 PM.