1

I'm wanting to trigger using udev under CoreOS a script on disk add/remove.

The purpose/goal is to automatically mount ceph data partitions to a specific directory in preparation for starting/stopping osd's in ceph-docker.

1) Firstly, CoreOS uses systemd. Should I be doing a systemd way, or do I just create my file under /etc/udev/rules.d ? (a directory which doesn't exist by default).

2) Lets say I do manage to detect a disk through udev and trigger a script with a device filename. How do I read /dev/sda and determine whether it is a ceph disk. i.e. I want to examine the typecode. It needs to be 4fbd7e29-9d25-41b8-afd0-062c0ceff05d

hookenz
  • 14,132
  • 22
  • 86
  • 142

1 Answers1

1

udev is very tightly integrated with systemd, so much so that you probably don't want to be creating rules with udev, but using systemd mount units:

http://www.freedesktop.org/software/systemd/man/systemd.mount.html

All of these options (including checking filesystem type) are supported by systemd.

Your ceph.mount file would look something like this:

[Unit]
Description=CEPH Partition
Before=my-docker-process.service

[Mount]
What=/dev/disk/by-uuid/59696d6c-2c78-48d0-b844-1c9590cfd0b0
Where=/media/ceph
Type=4fbd7e29-9d25-41b8-afd0-062c0ceff05d

In addition if that doesn't work for you there are also device units which configure udev: http://www.freedesktop.org/software/systemd/man/systemd.device.html

Brian Redbeard
  • 349
  • 3
  • 12