unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* File systems
@ 2014-05-10 21:39 Ludovic Courtès
  2014-05-14 17:12 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2014-05-10 21:39 UTC (permalink / raw)
  To: guix-devel

Hello,

It’s now possible to declare file systems to be mounted in
‘operating-system’ declarations, like this:

  (operating-system
   (file-systems (list (file-system
                         (device "/dev/sda1")
                         (mount-point "/")
                         (type "ext3")
                         (needed-for-boot? #t))
                       (file-system
                         (device "/dev/sda2")
                         (mount-point "/home")
                         (type "ext4")
                         (needed-for-boot? #f)))
   ;; ...
   )

File systems marked as “needed for boot” are checked and mounted by the
initrd.  This is always the case for /.  The initrd is meant to be
provisioned with the necessary kernel modules and fsck programs (see the
misnamed ‘qemu-initrd’ in (guix system linux-initrd).)

For each file system not “needed for boot”, a dmd service is created so
that it is mounted at a later point during the boot process.

To support clean unmounting of file systems upon shutdown, special dmd
services are added to the graph (see (gnu services base)):

  • ‘root-file-system’, whose stop action is to remount / read-only;
    this is the last service that is stopped when shutting down.

  • For each file system not needed for boot, there’s a
    ‘file-system-XYZ’ service depending only on ‘root-file-system’, with
    a stop action to unmount XYZ.

  • ‘user-processes’, which depends on all the ‘file-system-XYZ’ and on
    ‘root-file-system’.  Its stop action is to kill all the processes
    still running.  All the services that spawn processes must depend on
    it.  The goal is to make sure the file systems can actually be
    unmounted.

That seems to work well and is rather pleasant to work with.  Currently
the best way to test it is to build a freestanding VM image:

  ./pre-inst-env guix system vm-image --image-size=1.5GiB \
      build-aux/hydra/demo-os.scm

demo-os.scm doesn’t specify any file system, but that gets automatically
added by ‘system-qemu-image’ in (gnu system vm).

Next will come handling of swap devices and the device mapper (for
LUKS.)

Comments welcome!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: File systems
  2014-05-10 21:39 File systems Ludovic Courtès
@ 2014-05-14 17:12 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2014-05-14 17:12 UTC (permalink / raw)
  To: guix-devel

ludo@gnu.org (Ludovic Courtès) skribis:

> To support clean unmounting of file systems upon shutdown, special dmd
> services are added to the graph (see (gnu services base)):
>
>   • ‘root-file-system’, whose stop action is to remount / read-only;
>     this is the last service that is stopped when shutting down.
>
>   • For each file system not needed for boot, there’s a
>     ‘file-system-XYZ’ service depending only on ‘root-file-system’, with
>     a stop action to unmount XYZ.
>
>   • ‘user-processes’, which depends on all the ‘file-system-XYZ’ and on
>     ‘root-file-system’.  Its stop action is to kill all the processes
>     still running.  All the services that spawn processes must depend on
>     it.  The goal is to make sure the file systems can actually be
>     unmounted.

There was the complication that when root is a user-space file system,
like unionfs-fuse (as in the VM produced by ‘guix system vm’),
‘user-processes’ would kill it, thus leading to breakage just before
reboot.

Commit 7d57cfd fixes that by providing a mechanism to tell
‘user-processes’ which processes must remain alive during shutdown.  In
the unionfs-fuse case, the initrd code just writes the PID of
unionfs-fuse to /etc/dmd/do-not-kill, and ‘user-processes’ honors that file.

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-14 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-10 21:39 File systems Ludovic Courtès
2014-05-14 17:12 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).