1

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}/autostart.sh"

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 autostart.sh script during boot e.g. to start services only available on specific disks

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

John Doe
  • 279

2 Answers2

1

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.

quack quixote
  • 43,504
0

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.

Catherine
  • 16,610