# Optimizing fstab, mount problems

## Gabriel_Blake

Could you help me optimize my fstab ?? sdb1 sdc1 sdd1 sde1 are slots in my card reader (internal - connected via usb). sdf1 is made for my pendrive. I'd like all five of them to have a different address (other than sdx or hdx). Is it possible ?? 

What can I do to make the cdrom, flash cards and pendrive "hot plugged" ? At present the fstab is in fact useless because I have to mount and umount those drives manually when i want to use them. 

Do you have any advice for my about the boot options ?? Can I add something to make everything run faster ?

```

/dev/sda3      /boot      ext2      noatime         1 2

/dev/sda4      /      reiserfs   noatime         0 1

/dev/sda10      none      swap      sw         0 0

/dev/sr0      /mnt/cdrom   auto      user,auto,ro      0 0

/dev/sdb1      /mnt/cards/SD   auto      user,auto,rw      0 0

/dev/sdc1      /mnt/cards/CF   auto      user,auto,rw      0 0

/dev/sdd1      /mnt/cards/SM   auto      user,auto,rw      0 0

/dev/sde1      /mnt/cards/MS   auto      user,auto,rw      0 0

/dev/sdf1      /mnt/usb   vfat      user,auto,rw      0 0

shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0

proc         /proc      proc      nodev,nosuid,noexec   0 0

```

PS I know KDE can make pendrives hotplugged, but I'm using fluxbox.

----------

## Gabriel_Blake

Anyone ??

----------

## Lajasha

 *Gabriel_Blake wrote:*   

> Could you help me optimize my fstab ?? sdb1 sdc1 sdd1 sde1 are slots in my card reader (internal - connected via usb). sdf1 is made for my pendrive. I'd like all five of them to have a different address (other than sdx or hdx). Is it possible ?? 
> 
> 

 

I'm not quite sure what you mean by this, are you wanting it to have a name like /dev/blah? If so this as far as I know is not change able with out hacking up the dev system.

 *Gabriel_Blake wrote:*   

> 
> 
> What can I do to make the cdrom, flash cards and pendrive "hot plugged" ? At present the fstab is in fact useless because I have to mount and umount those drives manually when i want to use them. 
> 
> Do you have any advice for my about the boot options ?? Can I add something to make everything run faster ?
> ...

 

Hot plugging is really just controled by a daemon so you will have to try to find out that you can run and work the way you would like.

[url=http://gentoo-wiki.com/HOWTO_Auto_mount_filesystems_(AUTOFS)]You might like AutoFS[/url]

----------

## slackline

You can write custom udev rules so that you get /dev/pendrive which will point to /dev/sdf1 and similarly for your other /dev/sd* items.

The Gentoo-Wiki should get you going.

----------

## Gabriel_Blake

Thats not exactly the point. The problem is when I install another hdd it'll be marked as /dev/sdb and I'll have to rewrite fstab :/ I'm just looking for a method to leave "sdx" for disks and define a different "name" for pendrives and flash cards.

BTW Is there specific fs to define flash cards ??

----------

## slackline

 *Gabriel_Blake wrote:*   

> Thats not exactly the point. The problem is when I install another hdd it'll be marked as /dev/sdb and I'll have to rewrite fstab :/ I'm just looking for a method to leave "sdx" for disks and define a different "name" for pendrives and flash cards.
> 
> 

 

Actually I think you'll find it IS the point of udev rules.

You don't have to write the rule in such a manner that /dev/sdf1 is the basis of pointing to /dev/pendrive (which you could then use in your /etc/fstab instead of /dev/sdf1), you can write the rule for some other attribute that is specific to plugging your USB drive inwithout ever referring to /dev/sdf1 specifically.  Ditto for your other card-reader devices.

The following is an example from here (which is linked to from the wiki article)...

```

KERNEL=="sd*", SUBSYSTEMS="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"

```

This would create /dev/usbhd[n] (where n indicates the nth USB storage device that has been connected).  You can see that its looking for something at /dev/sd but its whether the attributes show that the device plugged in is a USB 2.0 Storage Device that are key.  You can then use /dev/usbhd[n] in your /etc/fstab, no need to re-write it when you add a hard drive as your using /dev/usbhd[n] as opposed to /dev/sde1 or whatever.  If you read the whole of the above article page, it tells you how to write simple scripts that will automatically mount devices when plugged in and detected by udev.

Maybe I've misunderstood your question, but you asked for sdb1 sdc1 etc. to be something other than sdx or hdx so you can use these alternatives in your /etc/fstab and udev is how you do this (at least its how I do it, I defer to someone else with greater knowledge who knows other ways of doing it).

----------

## hfk

 *Quote:*   

> Thats not exactly the point. The problem is when I install another hdd it'll be marked as /dev/sdb and I'll have to rewrite fstab :/ I'm just looking for a method to leave "sdx" for disks and define a different "name" for pendrives and flash cards. 

 

I suppose udevd is running. Have a look at /dev/disk/by*

If your drive got a label you would use /dev/disk/by-label/THE_LABEL 

```
/dev/disk/by-label/THE_LABEL /media/THE_LABEL auto noauto,user 0 0
```

doing

```
ls -l /dev/disk/by*/* 
```

and watching the changes when inserting/removing USB devices shows the effect.

BTW: automounting of devices when connected may be fine. But unmounting cannot work you have do do it manually, KDE -> menu, fluxbox -> command line.

----------

