Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to try to create a very minimized server installation which automatically mounts its internal SATA disks. Thus, I thought of using HAL as the way to go. As far as I read, HAL is just a daemon 'listening' for hardware changes and broadcasts the changes if they match a .fdi config file via dbus to its clients.

Which client can I use on a server install? I read about gnome-volume-manager as a possibility but as I see, it wants to open a graphical display, which I don't need on a server install (even if it's just a software-display).

Any hints for further direction or are there any alternative dbus clients which are able to execute HAL events?

I got it work, but without hal/devicekit/gnome. I'm using basic udev rules and RUN commands to mount the disks

# /etc/udev/rules.d/local.rules
# /etc/udev/rules.d/89-local.rules
# ADD rule: if we have a valid ID_FS_USAGE, and it's a filesystem with a UUID, mkdir and mount

ENV{ID_FS_USAGE}=="filesystem", ENV{ID_FS_UUID_ENC}=="?*", ACTION=="add", RUN="/bin/mkdir -p /media/$env{ID_FS_UUID_ENC}" RUN+="/bin/mount -t auto /dev/%k /media/$env{ID_FS_UUID_ENC}" RUN+="/media/$env{ID_FS_UUID_ENC}/"

On Ubuntu, put this in the file /lib/udev/rules.d/89-local.rules. On Debian it should be in /etc/udev/rules.d. I also added the possibility to run an script during boot e.g. to start services only available on specific disks

Ubuntu - Automatically mount external drives to /media/LABEL on boot without a user logged in? had the answer

share|improve this question
ya liked my udev answer better? that's cool too :) note i'd put the mkdir & mount commands in a set of chained scripts so the RUN finishes quickly -- that's important for udev. glad you got the boot situation figured out tho; i never really found a satisfactory solution for that. – quack quixote Jan 21 '10 at 21:01
ooo-- think i remember the quickly issue. if you mount an ext2/3 filesystem that's reached it's max mount count, isn't fsck kicked off automatically? that would take a while. think there are other situations where the mount might take longer than udev would want there. – quack quixote Jan 21 '10 at 21:09
yea, thx, ill definitly have a look on this – John Doe Jan 24 '10 at 19:14
@Udo when making edits for tag cleanup, please make sure to also check the post for anything else that needs fixing. A post like this that had lots of formatting issues, misspellings, etc. should be touched up in full - don't only edit the tags. Thanks. – nhinkle Sep 3 '13 at 3:34
@nhinkle: ok will do – udo Sep 3 '13 at 9:30
up vote 1 down vote accepted

HAL is a communication & message passing layer -- I'm honestly unsure of where DBus stops and HAL starts. It's mostly used as a layer between DBus and the Desktop Environment, but it doesn't have any GUI component that requires the DE to operate.

For a headless server installation you'd want to use HALevt. HALevt is a daemon that sits on top of HAL, much like Gnome-VFS does in the Gnome DE, and responds to hardware events. It can be configured to run as a system-wide daemon or as an individual user. See an answer I wrote to an earlier question about using HALevt to provide Gnome-VFS-like automounting for CDs and USB drives on a headless server. This should give you the basic how-to, although your situation would probably require some tweaking.

whitequark's answer -- setting up your normal mounts via /etc/fstab -- is better if your system's internal drives will not be setup for hotswapping. Using HALevt for mounting static internal disks is doable, but more complicated than it needs to be. But if you do have hotswap bays and you want to use them, using HALevt for automounting might be a good option for you.

share|improve this answer
also, i hear the next version of Ubuntu will be ditching HAL entirely, which makes me even more confused about it's specific job. so if you're planning on upgrading to 10.04LTS when it comes out, you might consider a non-HAL-based solution. – quack quixote Jan 20 '10 at 20:11
thx, ill have a look and just as a note: i did a bit research and it seems hal will be replaced by devicekit ( so thx for the int ~quack – John Doe Jan 21 '10 at 10:36

Internal SATA drives cannot be hotplugged, i.e. plugged in while your server is powered on. So everything you need to do is mount them at powerup. For this purpose you need just place them in /etc/fstab:

  1. Universal method that works for all filesystems:
    Add a line like /dev/sdXN /path/to/mountpoint auto defaults 0 2 where /dev/sdXN is your device pseudo-file.
  2. Ext2/Ext3-specific method:
    First, determine name of your device file in running system. Second, get it's UUID by running tune2fs -l /dev/sdXN | grep UUID under root, of course replacing sdXN by your device again. Afterwards you can add a line to fstab like I did in previous paragraph but replacing first value (/dev/sdXN) by (UUID=fa62e245-04bd-4cb2-a17f-5c7ee19e3574). Of course you need to replace mine UUID with yours. This method has an advantage that if you add or remove additional SATA drives mountpoints will not be affected by the order kernel detects these devices.

Also HAL is really don't needed on any server; it's a purely desktop utility that is needed to allow unprivileged users perform some privileged operations and through D-Bus only. You probably want to use console utilites that are much more suitable for server environment.

share|improve this answer
i don't think that's true (SATA drives can't be hotplugged) -- the SATA spec provides for hotplugging, but your chipset needs to support it explicitly and you need hotplug-capable power connectors. (this is how eSATA works, AFAIK.) – quack quixote Jan 20 '10 at 19:52
I said, not all SATA drives but only internal SATA drives, and it's unlikely that power connectors of standard internal SATA will be eSATA-compliant. – whitequark Jan 20 '10 at 20:18
what do you think are inside those hotplug SATA caddies? hotplug-capable internal SATA drives. see -- "All SATA devices support hotplugging." it does require the chipset to be in native mode (AHCI, not IDE-emulation mode). the power side of things is different; see – quack quixote Jan 20 '10 at 20:31
sorry, I actually meant "power cables that were in the box with internal drive" which are probably installed. also this discussion probably becomes somewhat offtopic. – whitequark Jan 20 '10 at 20:45
the reason i try to use hal instead of fstab is that fstab cant scale which also is part of the hotplugging problem but my main purpose is: i want a script (like .fdi) which is generalized so that i can use it on every future hardware which is based on the same rules i currently define and fstab is just too much work and error prone for my taste in my case – John Doe Jan 21 '10 at 10:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .