Next: Getting substitutes from Tor, Previous: Running Guix on a Linode Server, Up: System Configuration [Contents][Index]
To bind mount a file system, one must first set up some definitions
operating-system section of the system definition. In
this example we will bind mount a folder from a spinning disk drive to
/tmp, to save wear and tear on the primary SSD, without
dedicating an entire partition to be mounted as /tmp.
First, the source drive that hosts the folder we wish to bind mount should be defined, so that the bind mount can depend on it.
(define source-drive ;; "source-drive" can be named anything you want. (file-system (device (uuid "UUID goes here")) (mount-point "/path-to-spinning-disk-goes-here") (type "ext4"))) ;; Make sure to set this to the appropriate type for your drive.
The source folder must also be defined, so that guix will know it’s not a regular block device, but a folder.
(define (%source-directory) "/path-to-spinning-disk-goes-here/tmp") ;; "source-directory" can be named any valid variable name.
Finally, inside the
file-systems definition, we must add the
(file-systems (cons* ...<other drives omitted for clarity>... source-drive ;; Must match the name you gave the source drive in the earlier definition. (file-system (device (%source-directory)) ;; Make sure "source-directory" matches your earlier definition. (mount-point "/tmp") (type "none") ;; We are mounting a folder, not a partition, so this type needs to be "none" (flags '(bind-mount)) (dependencies (list source-drive)) ;; Ensure "source-drive" matches what you've named the variable for the drive. ) ...<other drives omitted for clarity>... ))