LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   to mount external drives on startup (https://www.linuxquestions.org/questions/debian-26/to-mount-external-drives-on-startup-795347/)

kutlu 03-14-2010 12:29 PM

to mount external drives on startup
 
I want all my external drives mounted when I start OS.

I don't want to do it for a specific external drive. I want my external drives mounted by default.

Do you have an idea? Does linux have such a configuration I can change?
Or do I have to write a script?

jschiwal 03-14-2010 12:51 PM

Yes you can, but it can cause boot failure if an external drive isn't present when you boot up. You can simply add and entry for it in /etc/fstab. Use the UUID number or LABEL instead of a temporal device node such as /dev/sdb1.

Here is an example:
sudo /sbin/blkid /dev/sdb3
/dev/sdb3: UUID="71836867-346e-4809-b05a-655565c59531" TYPE="ext3"

/dev/disk/by-id/scsi-SATA_WDC_WD3200BEKT-_WD-WXC0A8966517-part3 /home/jschiwal/hd2 ext3 acl,user_xattr 0 0
or
UUID=71836867-346e-4809-b05a-655565c59531 /home/jschiwal/hd2 ext3 acl,user_xattr 0 0

Use the values pertaining to your drive and mount point.
I would add the options "noauto,user" for an external drive. It wouldn't mount at boot, but it would allow the owner to mount the device without su'ing to root. You could use the mount command to your ~/.profile or ~/.bash_login file. That will defer mounting them until you log in.

I have two nfs shares I mount this way. In my ~/.bash_login,
grep /mnt/elite/podcasts /etc/mtab || mount /mnt/elite/podcasts >/dev/null 2>&1
grep /mnt/elite/Download /etc/mtab || mount /mnt/elite/Download >/dev/null 2>&1

In my ~/.bash_logout, I unmount them.
grep /mnt/elite/Download /etc/mtab && umount /mnt/elite/Download >/dev/null 2>&1
grep /mnt/elite/podcasts /etc/mtab && umount /mnt/elite/podcasts >/dev/null 2>&1

kutlu 03-14-2010 04:36 PM

I know it, but I ask for is different.

I repeat:
I don't want to do it for a specific external drive. I want my external drives mounted by default.

I am searching for this answer because I don't like the causalities of fstab method.

j1alu 03-15-2010 12:06 PM

gnome-volume-manager doesn't do it?

frieza 03-15-2010 12:24 PM

maybe automounter? i thought most modern distributions using KDE or gnome automatically mounted media such as usb drives or cdroms when inserted?

catkin 03-15-2010 12:28 PM

Quote:

Originally Posted by kutlu (Post 3897929)
Does linux have such a configuration I can change?
Or do I have to write a script?

I am not aware of any such configuration (that doesn't mean there isn't one).

If your OS implements udev, you could write udev rules to call a script.

catkin 03-15-2010 12:37 PM

Quote:

Originally Posted by frieza (Post 3899209)
maybe automounter? i thought most modern distributions using KDE or gnome automatically mounted media such as usb drives or cdroms when inserted?

autofs (automounter?) does not mount drives until they are accessed.

Using Xfce on Slackware 13.0, Thunar (Xfce's file system browser (a.k.a file manager) shows inserted drives greyed out and they are not mounted until browsed.

kutlu 03-15-2010 03:21 PM

Quote:

Originally Posted by catkin (Post 3899226)
autofs (automounter?) does not mount drives until they are accessed.

Using Xfce on Slackware 13.0, Thunar (Xfce's file system browser (a.k.a file manager) shows inserted drives greyed out and they are not mounted until browsed.

and this is exactly what my problem is.
thanks for clearification.

I do not like external disk mount failures, and fstab configurations which have to be written for each disk.
the way hald mounts drives is less problematic than fstab does.

Up to now, linux was perfect for my computer and disks which were online all the time. But I want my computer "restartable" and my expernals "plug-unplugable" now. :(

This is also an important request from developers.

catkin 03-15-2010 10:29 PM

Quote:

Originally Posted by kutlu (Post 3899434)
But I want my computer "restartable" and my expernals "plug-unplugable" now. :(

The first is achievable with custom programming.

The second is inherently difficult. Removing write caching would help but what if write-to-device was happening at the time of unplugging? And if the writing process re-tried it would write to the file system containing the mount point ... tricky!

The writeable CD/DVD ejection design is better than USB in this respect, allowing the user to request rejection any time (hardware or software eject button) but ejection is under software control and happens after unmounting.


All times are GMT -5. The time now is 03:37 AM.