Commit graph

79 commits

Author SHA1 Message Date
Tobias Geerinckx-Rice
e91c9ce32e
file-systems: Prefer low-memory mode of ‘btrfs check’.
* gnu/build/file-systems.scm (check-btrfs-file-system):
Add ‘--mode lowmem’ arguments when supported.

Reported by Noisytoot on #guix.
2021-09-28 22:08:23 +02:00
Tobias Geerinckx-Rice
34c105f929
file-systems: Add support for XFS.
* gnu/build/file-systems.scm (%xfs-endianness): New syntax.
(xfs-superblock?, read-xfs-superblock, xfs-superblock-uuid)
(xfs-superblock-volume-name, check-xfs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system):
Register them.
* doc/guix.texi (Keyboard Layout and Networking and Partitioning):
Note XFS support.
2021-09-23 18:17:17 +02:00
Tobias Geerinckx-Rice
09a8fb1f37
file-systems: Add file system to *-SUPERBLOCK-VOLUME-NAME docstrings.
* gnu/build/file-systems.scm (ext2-superblock-volume-name)
(bcachefs-superblock-volume-name, btrfs-superblock-volume-name)
(fat32-superblock-volume-name, fat16-superblock-volume-name)
(iso9660-superblock-volume-name, jfs-superblock-volume-name)
(f2fs-superblock-volume-name): Mention the file system type in the
docstring for consistency with the other superblock procedures.
2021-09-23 18:17:17 +02:00
Tobias Geerinckx-Rice
68b219b9f4
gnu: Don't abuse check-btrfs-file-system to scan.
It was never guaranteed to be run for non-root file systems.  It was for
root file systems only due to a bug now fixed.

* gnu/build/file-systems.scm (check-btrfs-file-system): Don't invoke
‘btrfs device scan’ here.
* gnu/system/linux-initrd.scm (raw-initrd): Do so here if any btrfs file
systems are present.
2021-09-23 18:17:16 +02:00
Tobias Geerinckx-Rice
602994847b
file-systems: Support forced checks & repairs.
* gnu/build/file-systems.scm (check-ext2-file-system)
(check-bcachefs-file-system, check-btrfs-file-system)
(check-fat-file-system, check-jfs-file-system, check-f2fs-file-system)
(check-ntfs-file-system, check-file-system): Take and honour new FORCE?
and REPAIR arguments.  Update the docstring.  Adjust all callers.
* gnu/system/file-systems.scm <file-system>: Add new SKIP-CHECK-IF-CLEAN?
and REPAIR fields.
(file-system->spec, spec->file-system): Adjust accordingly.
* gnu/build/linux-boot.scm (mount-root-file-system): Take new
SKIP-CHECK-IF-CLEAN? and REPAIR keyword arguments.  Thread them through
to CHECK-FILE-SYSTEM.
* doc/guix.texi (File Systems): Document both new <file-system> options.
2021-09-23 18:17:15 +02:00
Tobias Geerinckx-Rice
71f15ca871
file-systems: Rewrite comment.
* gnu/build/file-systems.scm (read-bcachefs-superblock): Make comment
less damned negative.
2021-05-04 15:40:32 +02:00
Tobias Geerinckx-Rice
b6269fb7bc
file-systems: Handle abnormal ‘bcachefs fsck’ exits.
* gnu/build/file-systems.scm (check-bcachefs-file-system): Handle a STATUS:EXIT-VAL of #F.
2021-05-04 15:40:32 +02:00
Ludovic Courtès
09ce4568f2
file-systems: read-partition-{uuid,label} don't swallow ENOENT & co.
Previously, (read-partition-uuid "/does/not/exist") would return #f.
With this change, a 'system-error exception is raised as expected.

* gnu/build/file-systems.scm (ENOENT-safe): Clarify docstring.
(partition-field-reader): Remove use of 'ENOENT-safe'.
(partition-predicate): Wrap READER in 'ENOENT-safe'.
2021-04-23 00:32:30 +02:00
Ludovic Courtès
b665dd4a99
file-systems: 'mount-file-system' preserves the right mount flags.
Fixes <https://bugs.gnu.org/47007>.
Reported by Jelle Licht <jlicht@fsfe.org>.

Since commit dcb640f02b, we could end up
applying the wrong mount flags because the (find ...) expression could
pick the "wrong" mount point in the presence of bind mounts.

* gnu/build/file-systems.scm (mount-file-system): Use 'statfs' to
compute FLAGS whe FS is a bind mount.
2021-03-10 23:21:33 +01:00
Ludovic Courtès
dcb640f02b
file-systems: 'mount-file-system' preserves source flags for bind mounts.
Fixes <https://bugs.gnu.org/46292>.

* gnu/build/file-systems.scm (mount-file-system): If FS is a bind mount,
add its original mount flags to FLAGS.
2021-02-25 11:29:35 +01:00
Tobias Geerinckx-Rice
23be018d4f
file-systems: Fix ‘bcachefs fsck’ exit value logic.
Bit 1 means the target device was mounted read-only whilst checking.
This should never happen in an initrd context but is not an error.

* gnu/build/file-systems.scm (check-bcachefs-file-system): Ignore status
bits that don't signal an error.  Remove the 'reboot-required case.
2020-12-06 16:11:43 +01:00
Tobias Geerinckx-Rice
174254749d
file-systems: Add support for bcachefs.
* gnu/build/file-systems.scm (%bcachefs-endianness): New syntax.
(bcachefs-superblock?, read-bcachefs-superblock)
(bcachefs-superblock-external-uuid, bcachefs-superblock-volume-name)
(check-bcachefs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system):
Register them.
2020-11-07 13:40:45 +01:00
Ludovic Courtès
11e19555e5
file-systems: Allow swap space lookup by UUID/label.
* gnu/build/file-systems.scm (%linux-swap-magic, %page-size): New
variables.
(linux-swap-superblock?, read-linux-swap-superblock)
(linux-swap-superblock-uuid, linux-swap-superblock-volume-name): New
procedures.
(%partition-label-readers, %partition-uuid-readers): Add them.
2020-10-30 01:14:20 +01:00
Stefan
1c3b709edb
linux-boot: Handle nfs-root device strings.
* gnu/build/linux-boot.scm (device-string->file-system-device): Support
nfs-root "device" strings.
* gnu/build/file-systems.scm (canonicalize-device-spec): Support nfs-root
"device" strings.
* gnu/machine/ssh.scm (machine-check-file-system-availability): Avoid
checking of NFS file systems.
* gnu/system.scm (read-boot-parameters, device-sexp->device): Support
nfs-root "device" strings.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2020-09-07 11:00:48 +02:00
Mathieu Othacehe
7c27bd115b
file-system: Add mount-may-fail? option.
* gnu/system/file-systems.scm (<file-system>): Add a mount-may-fail? field.
(file-system->spec): adapt accordingly,
(spec->file-system): ditto.
* gnu/build/file-systems.scm (mount-file-system): If 'system-error is raised
and mount-may-fail? is true, ignore it. Otherwise, re-raise the exception.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-07-31 13:43:20 +02:00
Mathieu Othacehe
675e56221e
file-systems: Add NTFS support.
* gnu/system/uuid.scm (%ntfs-endianness): New macro,
(ntfs-uuid->string): new procedure,
(%ntfs-endianness): new variable,
(string->ntfs-uuid): new exported procedure,
(%uuid-parsers): add NTFS support,
(%uuid-printers): add NTFS support.
* gnu/build/file-systems.scm (%ntfs-endianness): New macro,
(ntfs-superblock?, read-ntfs-superblock, ntfs-superblock-uuid,
check-ntfs-file-system): new procedure,
(%partition-uuid-readers): add NTFS support,
(check-file-system): add NTFS support.
2020-07-26 18:35:10 +02:00
Maxim Cournoyer
281d80d8e5
linux-boot: Refactor boot-system.
The --root option can now be omitted, and inferred from the root file system
declaration instead.

* gnu/build/file-systems.scm (canonicalize-device-spec): Extend to support NFS
directly, and...
* gnu/build/linux-boot.scm (boot-system): ...remove NFS special casing from
here.  Remove nested definitions for root-fs-type, root-fs-flags and
root-fs-options, and bind those inside the let* instead.  Make "--root" take
precedence over the device field string representation of the root file
system.
* doc/guix.texi (Initial RAM Disk): Document that "--root" can be left
unspecified.
2020-05-20 08:30:34 -04:00
Danny Milosavljevic
bb357c509e
file-systems: Fix UTF-16 handling in initrd.
Follow-up to f73f4b3a2d.

* gnu/build/file-systems.scm (bytevector->u16-list): New procedure.
(utf16->string): New procedure.
2020-05-03 23:04:57 +02:00
Danny Milosavljevic
f73f4b3a2d
file-systems: Fix F2FS volume name accessor.
Follow-up to 23b37c3d40.

* gnu/build/file-systems.scm (bytevector-utf16-length): New procedure.
(null-terminated-utf16->string): New procedure.
(f2fs-superblock-volume-name): Use it.
2020-05-03 20:35:50 +02:00
raingloom
23b37c3d40
file-systems: Add support for F2FS.
* gnu/build/file-systems.scm (%f2fs-endianness): New syntax.
(f2fs-superblock?, read-f2fs-superblock, f2fs-superblock-uuid)
(f2fs-superblock-volume-name, check-f2fs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system): Register them.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2020-05-02 10:49:24 +02:00
Maxim Cournoyer
85a7466e22
build: file-systems: Do not warn about file system check for NFS.
* gnu/build/file-systems.scm (check-file-system): Define a dummy checker
procedure for NFS that always passes to prevent a warning from being emitted.
2020-03-02 23:59:45 -05:00
David Trudgian
7aa28eb339
file-systems: Handle LUKS2 header.
* gnu/build/file-systems.scm (luks-superblock?): Handle LUKS2 header.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2020-01-05 11:14:00 +01:00
Tobias Geerinckx-Rice
1abbe7c64b
file-systems: Add support for JFS.
* gnu/build/file-systems.scm (%jfs-endianness): New syntax.
(jfs-superblock?, read-jfs-superblock, jfs-superblock-uuid)
(jfs-superblock-volume-name, check-jfs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system):
Register them.
2020-01-03 13:54:13 +01:00
Guillaume Le Vaillant
0dc5c85638
file-systems: Add support for 'strict-atime' and 'lazy-time' flags.
* guix/build/syscalls.scm (MS_LAZYTIME): New variable.
* gnu/build/file-systems.scm (mount-flags->bit-mask): Add match rules for
  'strict-atime' and 'lazy-time'.
* doc/guix.texi (File Systems): Add 'strict-atime' and 'lazy-time' to the list
  of supported flags.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-12-07 01:00:24 +01:00
Maxim Cournoyer
d2ae8a25db
file-systems: Fix docstring.
* gnu/build/file-systems.scm (mount-file-system): Clean the documentation from
the no longer existing parameters (these are now encapsulated within a
<file-system> record).
2019-11-18 13:22:16 +09:00
rendaw
9d3053819d
file-systems: Support the 'no-atime' flag.
* guix/build/syscalls.scm (MS_NOATIME): New variable.
* gnu/build/file-systems.scm (mount-flags->bit-mask): Support it.
* doc/guix.texi (File Systems): Document it and add cross-references to
the relevant documentation.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2019-04-29 12:19:03 +02:00
Mathieu Othacehe
8ae7044f1d
file-systems: Add read-luks-partition-uuid.
Add a specific procedure to read luks partition uuid.

* gnu/build/file-systems.scm (luks-partition-field-reader): New procedure ...
(luks-partition-uuid-predicate): ... used here,
(read-luks-partition-uuid): new exported procedure.
2019-01-17 14:04:26 +01:00
Mathieu Othacehe
983abd2cf9
file-systems: Export read-partition-label and read-partition-uuid.
* gnu/build/file-systems.scm (read-partition-label): Export it,
(read-partition-uuid): ditto.
2019-01-17 14:04:22 +01:00
Ludovic Courtès
5de5f81845
file-systems: Have the emergency REPL output to /dev/console.
This fixes a bug whereby all emergency REPL output would go to /dev/klog
and thus, each line would be prefixed by "[12324.432] shepherd[1]: ".

* gnu/build/file-systems.scm (check-file-system): Wrap 'start-repl' call
in 'with-output-to-file'.
2018-12-18 16:04:26 +01:00
Ludovic Courtès
6ea6e1476f
file-systems: Spawn a REPL only when interaction is possible.
Fixes <https://bugs.gnu.org/23697>.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.

* gnu/build/file-systems.scm (check-file-system): Call 'start-repl' only
if current-input-port passes 'isatty?'.
* gnu/services/shepherd.scm (shepherd-configuration-file): After
'for-each' expression, call 'redirect-port'.
* gnu/tests/base.scm (run-basic-test)["stdin is /dev/null"]: New test.
2018-12-18 16:04:26 +01:00
Ludovic Courtès
69a05eab35
file-systems: Always wait for devices to show up.
Previously, 'canonicalize-device-spec' would wait for devices when they
were specified as a label or UUID, but would not wait when the user
passed a "/dev" file name directly.  This could cause problems when
the /dev node takes a while to show up.

* gnu/build/file-systems.scm (canonicalize-device-spec): Add 'resolve'
call in the 'string?' case.
2018-05-31 18:13:08 +02:00
Ludovic Courtès
a5acc17a3c
file-systems: Remove 'title' field and add <file-system-label>.
The 'title' field was easily overlooked and was an endless source of
confusion.  Now, the value of the 'device' field is self-contained.

* gnu/system/file-systems.scm (<file-system>): Change constructor name
to '%file-system'.
[title]: Remove.
(<file-system-label>): New record type with printer.
(report-deprecation, device-expression)
(process-file-system-declaration, file-system): New macros.
(file-system-title): New procedure.
(file-system->spec, spec->file-system): Adjust to handle
<file-system-label>.
* gnu/system.scm (bootable-kernel-arguments): Add case for
'file-system-label?'.
(read-boot-parameters): Likewise.
(mapped-device-user): Avoid 'file-system-title'.
(fs->boot-device): Remove.
(operating-system-boot-parameters): Use 'file-system-device' instead of
'fs->boot-device'.
(device->sexp): Add case for 'file-system-label?'.
* gnu/bootloader/grub.scm (grub-root-search): Add case for
'file-system-label?'.
* gnu/system/examples/bare-bones.tmpl,
gnu/system/examples/beaglebone-black.tmpl,
gnu/system/examples/lightweight-desktop.tmpl,
gnu/system/examples/vm-image.tmpl: Remove uses of 'title'.
* gnu/system/vm.scm (virtualized-operating-system): Remove uses of
'file-system-title'.
* guix/scripts/system.scm (check-file-system-availability): Likewise,
and adjust fix-it hint.
(check-initrd-modules)[file-system-/dev]: Likewise.
* gnu/build/file-systems.scm (canonicalize-device-spec): Remove 'title'
parameter.
[canonical-title]: Remove.
Match on SPEC's type rather than on CANONICAL-TITLE.
(mount-file-system): Adjust caller.
* gnu/build/linux-boot.scm (boot-system): Interpret ROOT here.
* gnu/services/base.scm (file-system->fstab-entry): Remove use of
'file-system-title'.
* doc/guix.texi (File Systems): Remove documentation of the 'title'
field.  Rewrite documentation of 'device' and document
'file-system-label'.
2018-05-28 13:24:11 +02:00
Tobias Geerinckx-Rice
162a137400
gnu: Consistently Write ‘file system(s)’.
It is the GNU way.

* doc/guix.texi (Build Systems, DNS Services): Write ‘file system(s)’.
* gnu/build/vm.scm (create-ext-file-system, create-fat-file-system):
Likewise.
* gnu/packages/backup.scm (dirvish, rsnapshot)[description]: Likewise.
* gnu/packages/check.scm (python-testpath)[description]: Likewise.
* gnu/packages/disk.scm (pydf)[description]: Likewise.
* gnu/packages/file-systems.scm (disorderfs)[synopsis, description]: Likewise.
(glusterfs)[description]: Likewise.
* gnu/packages/haskell.scm (ghc-directory, ghc-system-fileio-bootstrap)
(ghc-system-fileio)[synopsis]: Likewise.
(ghc-fsnotify)[description]: Likewise.
* gnu/packages/linux.scm (proot)[description]: Likewise.
(jmtpfs)[synopsis, description]: Likewise.
* gnu/packages/mate.scm (caja, caja-extensions)[description]: Likewise.
* gnu/packages/storage.scm (ceph)[description]: Likewise.
* gnu/packages/sync.scm (lsyncd)[description]: Likewise.
* gnu/packages/syncthing.scm (syncthing)[synopsis]: Likewise.
(go-github-com-zillode-notify)[description]: Likewise.
* gnu/services/nfs.scm (pipefs-service-type): Likewise.
* guix/scripts/system.scm (perform-action): Likewise.
2018-01-19 17:28:31 +01:00
Ludovic Courtès
88235675fc
file-systems: Add support for FAT16.
* gnu/build/file-systems.scm (check-fat32-file-system): Rename to...
(check-fat-file-system): ... this.
(check-file-system): Adjust accordingly.
(fat16-superblock?, read-fat16-superblock)
(fat16-superblock-uuid, fat16-superblock-volume-name): New procedures.
(%partition-label-readers, %partition-uuid-readers): Add FAT16.
2017-10-11 11:12:33 +02:00
Ludovic Courtès
9976c76aab
file-systems: Preserve UUID types when serializing.
Reported by Roel Janssen <roel@gnu.org>
at <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>.

* gnu/system/file-systems.scm (file-system->spec): When DEVICE is a
UUID, serialize it in a way that preserves its type.
(spec->file-system): Adjust accordingly.
* gnu/build/file-systems.scm (canonicalize-device-spec): Add case for
when SPEC is 'uuid?'.
2017-10-11 11:12:33 +02:00
Ludovic Courtès
1c65cca574
file-systems: 'mount-file-system' now takes a <file-system> object.
* gnu/build/file-systems.scm (mount-file-system): Rename 'spec' to 'fs'
and assume it's a <file-system>.
* gnu/build/linux-boot.scm (boot-system): Assume MOUNTS is a list of
<file-system> and adjust accordingly.
* gnu/build/linux-container.scm (mount-file-systems): Remove
'file-system->spec' call.
* gnu/services/base.scm (file-system-shepherd-service): Add
'spec->file-system' call.  Add (gnu system file-systems) to 'modules'.
* gnu/system/linux-initrd.scm (raw-initrd): Use (gnu system
file-systems).  Add 'spec->file-system' call for #:mounts.
2017-10-11 11:12:33 +02:00
Ludovic Courtès
aed1f1b049
uuid: Add 'uuid=?' and use it.
* gnu/system/uuid.scm (uuid=?): New procedure.
* tests/uuid.scm ("uuid=?"): New test.
* gnu/build/file-systems.scm (partition-uuid-predicate)
(luks-partition-uuid-predicate): Use it instead of 'bytevector=?'.
2017-10-05 12:09:17 +02:00
Ludovic Courtès
47cef4ecad
file-systems: Introduce (gnu system uuid).
* gnu/build/file-systems.scm (sub-bytevector)
(latin1->string, %fat32-endianness, fat32-uuid->string)
(%iso9660-uuid-rx, string->iso9660-uuid)
(iso9660-uuid->string, %network-byte-order)
(dce-uuid->string, %uuid-rx, string->dce-uuid)
(string->ext2-uuid, string->ext3-uuid, string->ext4-uuid)
(vhashq, %uuid-parsers, %uuid-printers, string->uuid)
(uuid->string): Move to...
* gnu/system/uuid.scm: ... here.  New file.
* gnu/system/file-systems.scm (uuid): Move to the above file.
* gnu/system/vm.scm: Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add uuid.scm.
2017-09-11 22:24:46 +02:00
Ludovic Courtès
a8e1247d7d
file-systems: Add UUID type dictionaries.
* gnu/build/file-systems.scm (uuid->string): Rename to...
(dce-uuid->string): ... this.
(string->uuid): Rename to...
(string->dce-uuid): ... this.
(vhashq): New macro.
(%uuid-parsers, %uuid-printers): New variables.
(uuid->string, string->uuid): New procedures.
2017-09-11 22:24:46 +02:00
Danny Milosavljevic
9833bcfc08
build: Allow mounting of entire disks.
* gnu/build/file-systems.scm (disk-partitions): Also return entire drives.
2017-08-05 18:49:33 +02:00
Danny Milosavljevic
1feb3076cb
build: Allow specifying volume-uuid with make-iso9660-image.
* gnu/build/file-systems.scm (iso9660-uuid->string): Export.
* gnu/build/vm.scm (make-iso9660-image): Add volume-uuid.
2017-07-03 15:07:25 +02:00
Danny Milosavljevic
9c0a05b31e
file-systems: iso9660-uuid->string: Use "-" as separator in the result.
* gnu/build/file-systems.scm (iso9660-uuid->string): Use "-" as separator
in the result.
2017-07-02 19:27:25 +02:00
Adam Van Ymeren
b53510e0d0
file-systems: Handle EIO error in 'ENOENT-safe' as well.
Trying to boot GuixSD when an audio CD is in the drive will die with an
"input/output error" when trying to read the superblock from the cd
drive.

This patch catches and warns in this case rather than dying.

* gnu/build/file-systems.scm (ENOENT-safe): Handle EIO.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-06-11 23:09:19 +02:00
Danny Milosavljevic
a81cae38ca
file-systems: Provide string->ext*-uuid, string->btrfs-uuid.
* gnu/build/file-systems.scm (string->ext2-uuid, string->ext3-uuid,
string->ext4-uuid, string->btrfs-uuid): New variables.  Export them.
2017-06-10 19:22:03 +02:00
Danny Milosavljevic
bb7cf4f533
file-systems: Provide string->iso9660-uuid.
* gnu/build/file-systems.scm (string->iso9660-uuid): New variable.  Export it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-06-09 12:30:56 +02:00
Danny Milosavljevic
c6aee77e29
file-systems: Use creation time if modification time is unset for ISO9660.
* gnu/build/file-systems.scm (iso9660-superblock-uuid): Modify.
2017-06-07 08:34:52 +02:00
Danny Milosavljevic
fb03f44bb1
file-systems: Improve error handling in the iso9660 case - fixes boot problem.
* gnu/build/file-systems.scm (read-iso9660-superblock): Modify.
2017-06-03 22:10:23 +02:00
Danny Milosavljevic
203a9455c4
file-systems: Improve error reporting.
Suggested by Chris Marusich <cmmarusich@gmail.com>.
Fixes <https://bugs.gnu.org/27143>.

* gnu/build/file-systems.scm (read-iso9660-primary-volume-descriptor):
Improve error reporting.
2017-05-31 21:13:15 +02:00
Danny Milosavljevic
cdc701ea48
gnu: build: Improve comments.
* gnu/build/file-systems.scm (iso9660-superblock-volume-name):
Add clarifying comment.
2017-05-31 19:38:49 +02:00
Danny Milosavljevic
3dba9b3782
gnu: build: Improve docstrings.
* gnu/build/file-systems.scm (iso9660-superblock?,
read-iso9660-superblock, iso9660-superblock-uuid): Improve docstrings.
2017-05-27 12:35:43 +02:00