install: Use overlayfs instead of unionfs.
I dediced to keep adding /tmp as tmpfs since I was not able to trigger bug while still using unionfs, so I could not verify whether this mount is still needed with overlayfs. Mapping /tmp to tmpfs does not harm, so we are on the save side. * gnu/system/install.scm (make-cow-store): Mount /gnu/store without additional read-only bind-mount, since in overlayfs the "lower" level is always read-only. Add work-dir required by overlayfs. No need to sleep anymore since now using the mount syscall. [unionfs]: Remove now unused function. (%installation-services): Update comment. (installation-os)[file-systems]: Update comment.
This commit is contained in:
parent
c828969036
commit
d9565f7d87
|
@ -71,19 +71,6 @@ manual."
|
||||||
"Return a gexp that makes the store copy-on-write, using TARGET as the
|
"Return a gexp that makes the store copy-on-write, using TARGET as the
|
||||||
backing store. This is useful when TARGET is on a hard disk, whereas the
|
backing store. This is useful when TARGET is on a hard disk, whereas the
|
||||||
current store is on a RAM disk."
|
current store is on a RAM disk."
|
||||||
(define (unionfs read-only read-write mount-point)
|
|
||||||
;; Make MOUNT-POINT the union of READ-ONLY and READ-WRITE.
|
|
||||||
|
|
||||||
;; Note: in the command below, READ-WRITE appears before READ-ONLY so that
|
|
||||||
;; it is considered a "higher-level branch", as per unionfs-fuse(8),
|
|
||||||
;; thereby allowing files existing on READ-ONLY to be copied over to
|
|
||||||
;; READ-WRITE.
|
|
||||||
#~(fork+exec-command
|
|
||||||
(list (string-append #$unionfs-fuse "/bin/unionfs")
|
|
||||||
"-o"
|
|
||||||
"cow,allow_other,use_ino,max_files=65536,nonempty"
|
|
||||||
(string-append #$read-write "=RW:" #$read-only "=RO")
|
|
||||||
#$mount-point)))
|
|
||||||
|
|
||||||
(define (set-store-permissions directory)
|
(define (set-store-permissions directory)
|
||||||
;; Set the right perms on DIRECTORY to use it as the store.
|
;; Set the right perms on DIRECTORY to use it as the store.
|
||||||
|
@ -97,23 +84,21 @@ current store is on a RAM disk."
|
||||||
(mkdir-p tmpdir)
|
(mkdir-p tmpdir)
|
||||||
(mount tmpdir "/tmp" "none" MS_BIND))
|
(mount tmpdir "/tmp" "none" MS_BIND))
|
||||||
|
|
||||||
(unless (file-exists? "/.ro-store")
|
(let* ((rw-dir (string-append target #$%backing-directory))
|
||||||
(mkdir "/.ro-store")
|
(work-dir (string-append rw-dir "/../.overlayfs-workdir")))
|
||||||
(mount #$(%store-prefix) "/.ro-store" "none"
|
|
||||||
(logior MS_BIND MS_RDONLY)))
|
|
||||||
|
|
||||||
(let ((rw-dir (string-append target #$%backing-directory)))
|
|
||||||
(mkdir-p rw-dir)
|
(mkdir-p rw-dir)
|
||||||
|
(mkdir-p work-dir)
|
||||||
(mkdir-p "/.rw-store")
|
(mkdir-p "/.rw-store")
|
||||||
#$(set-store-permissions #~rw-dir)
|
#$(set-store-permissions #~rw-dir)
|
||||||
#$(set-store-permissions "/.rw-store")
|
#$(set-store-permissions "/.rw-store")
|
||||||
|
|
||||||
;; Mount the union, then atomically make it the store.
|
;; Mount the overlay, then atomically make it the store.
|
||||||
(and #$(unionfs "/.ro-store" #~rw-dir "/.rw-store")
|
(mount "none" "/.rw-store" "overlay" 0
|
||||||
(begin
|
(string-append "lowerdir=" #$(%store-prefix) ","
|
||||||
(sleep 1) ;XXX: wait for unionfs to be ready
|
"upperdir=" rw-dir ","
|
||||||
|
"workdir=" work-dir))
|
||||||
(mount "/.rw-store" #$(%store-prefix) "" MS_MOVE)
|
(mount "/.rw-store" #$(%store-prefix) "" MS_MOVE)
|
||||||
(rmdir "/.rw-store"))))))
|
(rmdir "/.rw-store"))))
|
||||||
|
|
||||||
(define cow-store-service-type
|
(define cow-store-service-type
|
||||||
(shepherd-service-type
|
(shepherd-service-type
|
||||||
|
@ -278,7 +263,7 @@ You have been warned. Thanks for being so brave.
|
||||||
(allow-empty-passwords? #f)
|
(allow-empty-passwords? #f)
|
||||||
(password-authentication? #t)))
|
(password-authentication? #t)))
|
||||||
|
|
||||||
;; Since this is running on a USB stick with a unionfs as the root
|
;; Since this is running on a USB stick with a overlayfs as the root
|
||||||
;; file system, use an appropriate cache configuration.
|
;; file system, use an appropriate cache configuration.
|
||||||
(nscd-service (nscd-configuration
|
(nscd-service (nscd-configuration
|
||||||
(caches %nscd-minimal-caches)))
|
(caches %nscd-minimal-caches)))
|
||||||
|
@ -317,10 +302,12 @@ Use Alt-F2 for documentation.
|
||||||
(title 'label)
|
(title 'label)
|
||||||
(type "ext4"))
|
(type "ext4"))
|
||||||
|
|
||||||
;; Make /tmp a tmpfs instead of keeping the unionfs. This is
|
;; Make /tmp a tmpfs instead of keeping the overlayfs. This
|
||||||
;; because FUSE creates '.fuse_hiddenXYZ' files for each open file,
|
;; originally was used for unionfs because FUSE creates
|
||||||
;; and this confuses Guix's test suite, for instance. See
|
;; '.fuse_hiddenXYZ' files for each open file, and this confuses
|
||||||
;; <http://bugs.gnu.org/23056>.
|
;; Guix's test suite, for instance (see
|
||||||
|
;; <http://bugs.gnu.org/23056>). We keep this for overlayfs to be
|
||||||
|
;; on the save side.
|
||||||
(file-system
|
(file-system
|
||||||
(mount-point "/tmp")
|
(mount-point "/tmp")
|
||||||
(device "none")
|
(device "none")
|
||||||
|
|
Loading…
Reference in New Issue