mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
repart: support erofs
So, i think "erofs" is probably the better, more modern alternative to "squashfs". Many of the benefits don't matter too much to us I guess, but there's one thing that stands out: erofs has a UUID in the superblock, squashfs has not. Having an UUID in the superblock matters if the file systems are used in an overlayfs stack, as overlayfs uses the UUIDs to robustly and persistently reference inodes on layers in case of metadata copy-up. Since we probably want to allow such uses in overlayfs as emplyoed by sysext (and the future syscfg) we probably should ramp up our erofs game early on. Hence let's natively support erofs, test it, and in fact mention it in the docs before squashfs even.
This commit is contained in:
parent
5e5fce3e91
commit
09e917ea4d
@ -223,8 +223,8 @@ images minimal.
|
|||||||
|
|
||||||
If the image is writable, and some of the files or directories that are
|
If the image is writable, and some of the files or directories that are
|
||||||
overmounted from the host do not exist yet they will be automatically created.
|
overmounted from the host do not exist yet they will be automatically created.
|
||||||
On read-only, immutable images (e.g. squashfs images) all files and directories
|
On read-only, immutable images (e.g. `erofs` or `squashfs` images) all files
|
||||||
to over-mount must exist already.
|
and directories to over-mount must exist already.
|
||||||
|
|
||||||
Note that as no new image format or metadata is defined, it's very
|
Note that as no new image format or metadata is defined, it's very
|
||||||
straightforward to define images than can be made use of in a number of
|
straightforward to define images than can be made use of in a number of
|
||||||
|
@ -383,12 +383,13 @@
|
|||||||
<term><varname>Format=</varname></term>
|
<term><varname>Format=</varname></term>
|
||||||
|
|
||||||
<listitem><para>Takes a file system name, such as <literal>ext4</literal>, <literal>btrfs</literal>,
|
<listitem><para>Takes a file system name, such as <literal>ext4</literal>, <literal>btrfs</literal>,
|
||||||
<literal>xfs</literal>, <literal>vfat</literal>, <literal>squashfs</literal>, or the special value
|
<literal>xfs</literal>, <literal>vfat</literal>, <literal>erofs</literal>,
|
||||||
<literal>swap</literal>. If specified and the partition is newly created it is formatted with the
|
<literal>squashfs</literal> or the special value <literal>swap</literal>. If specified and the partition
|
||||||
specified file system (or as swap device). The file system UUID and label are automatically derived
|
is newly created it is formatted with the specified file system (or as swap device). The file system
|
||||||
from the partition UUID and label. If this option is used, the size allocation algorithm is slightly
|
UUID and label are automatically derived from the partition UUID and label. If this option is used,
|
||||||
altered: the partition is created as least as big as required for the minimal file system of the
|
the size allocation algorithm is slightly altered: the partition is created as least as big as
|
||||||
specified type (or 4KiB if the minimal size is not known).</para>
|
required for the minimal file system of the specified type (or 4KiB if the minimal size is not
|
||||||
|
known).</para>
|
||||||
|
|
||||||
<para>This option has no effect if the partition already exists.</para>
|
<para>This option has no effect if the partition already exists.</para>
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@
|
|||||||
<listitem><para>Plain directories or btrfs subvolumes containing the OS tree</para></listitem>
|
<listitem><para>Plain directories or btrfs subvolumes containing the OS tree</para></listitem>
|
||||||
<listitem><para>Disk images with a GPT disk label, following the <ulink
|
<listitem><para>Disk images with a GPT disk label, following the <ulink
|
||||||
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink></para></listitem>
|
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink></para></listitem>
|
||||||
<listitem><para>Disk images lacking a partition table, with a naked Linux file system (e.g. squashfs or ext4)</para></listitem>
|
<listitem><para>Disk images lacking a partition table, with a naked Linux file system (e.g. erofs,
|
||||||
|
squashfs or ext4)</para></listitem>
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
|
|
||||||
<para>These image formats are the same ones that
|
<para>These image formats are the same ones that
|
||||||
|
@ -335,6 +335,14 @@ int make_filesystem(
|
|||||||
return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mksquashfs binary not available.");
|
return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mksquashfs binary not available.");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to determine whether mksquashfs binary exists: %m");
|
return log_error_errno(r, "Failed to determine whether mksquashfs binary exists: %m");
|
||||||
|
|
||||||
|
} else if (streq(fstype, "erofs")) {
|
||||||
|
r = find_executable("mkfs.erofs", &mkfs);
|
||||||
|
if (r == -ENOENT)
|
||||||
|
return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mkfs.erofs binary not available.");
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to determine whether mkfs.erofs binary exists: %m");
|
||||||
|
|
||||||
} else if (fstype_is_ro(fstype)) {
|
} else if (fstype_is_ro(fstype)) {
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
|
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
|
||||||
"Don't know how to create read-only file system '%s', refusing.",
|
"Don't know how to create read-only file system '%s', refusing.",
|
||||||
@ -501,6 +509,12 @@ int make_filesystem(
|
|||||||
root, node,
|
root, node,
|
||||||
"-quiet",
|
"-quiet",
|
||||||
"-noappend");
|
"-noappend");
|
||||||
|
|
||||||
|
else if (streq(fstype, "erofs"))
|
||||||
|
|
||||||
|
argv = strv_new(mkfs,
|
||||||
|
"-U", vol_id,
|
||||||
|
node, root);
|
||||||
else
|
else
|
||||||
/* Generic fallback for all other file systems */
|
/* Generic fallback for all other file systems */
|
||||||
argv = strv_new(mkfs, node);
|
argv = strv_new(mkfs, node);
|
||||||
@ -539,6 +553,9 @@ int make_filesystem(
|
|||||||
if (STR_IN_SET(fstype, "ext2", "ext3", "ext4", "btrfs", "f2fs", "xfs", "vfat", "swap"))
|
if (STR_IN_SET(fstype, "ext2", "ext3", "ext4", "btrfs", "f2fs", "xfs", "vfat", "swap"))
|
||||||
log_info("%s successfully formatted as %s (label \"%s\", uuid %s)",
|
log_info("%s successfully formatted as %s (label \"%s\", uuid %s)",
|
||||||
node, fstype, label, vol_id);
|
node, fstype, label, vol_id);
|
||||||
|
else if (streq(fstype, "erofs"))
|
||||||
|
log_info("%s successfully formatted as %s (uuid %s, no label)",
|
||||||
|
node, fstype, vol_id);
|
||||||
else
|
else
|
||||||
log_info("%s successfully formatted as %s (no label or uuid specified)",
|
log_info("%s successfully formatted as %s (no label or uuid specified)",
|
||||||
node, fstype);
|
node, fstype);
|
||||||
|
@ -13,8 +13,10 @@ test_append_files() {
|
|||||||
if ! get_bool "${TEST_NO_QEMU:=}"; then
|
if ! get_bool "${TEST_NO_QEMU:=}"; then
|
||||||
install_dmevent
|
install_dmevent
|
||||||
instmods dm_verity =md
|
instmods dm_verity =md
|
||||||
|
instmods erofs
|
||||||
generate_module_dependencies
|
generate_module_dependencies
|
||||||
image_install -o /sbin/mksquashfs
|
image_install -o /sbin/mksquashfs
|
||||||
|
image_install -o /bin/mkfs.erofs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inst_binary mcopy
|
inst_binary mcopy
|
||||||
|
@ -901,7 +901,7 @@ test_minimize() {
|
|||||||
# shellcheck disable=SC2064
|
# shellcheck disable=SC2064
|
||||||
trap "rm -rf '$defs' '$imgs'" RETURN
|
trap "rm -rf '$defs' '$imgs'" RETURN
|
||||||
|
|
||||||
for format in ext4 vfat; do
|
for format in ext4 vfat erofs; do
|
||||||
if ! command -v "mkfs.$format" >/dev/null; then
|
if ! command -v "mkfs.$format" >/dev/null; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user