Merge pull request #42183 from kisik21/master
nixos/stage-1, nixos/f2fs: added F2FS resizing
This commit is contained in:
commit
a6b97bd1bb
|
@ -340,6 +340,10 @@ mountFS() {
|
||||||
echo "resizing $device..."
|
echo "resizing $device..."
|
||||||
e2fsck -fp "$device"
|
e2fsck -fp "$device"
|
||||||
resize2fs "$device"
|
resize2fs "$device"
|
||||||
|
elif [ "$fsType" = f2fs ]; then
|
||||||
|
echo "resizing $device..."
|
||||||
|
fsck.f2fs -fp "$device"
|
||||||
|
resize.f2fs "$device"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -127,8 +127,8 @@ let
|
||||||
copy_bin_and_libs ${pkgs.kmod}/bin/kmod
|
copy_bin_and_libs ${pkgs.kmod}/bin/kmod
|
||||||
ln -sf kmod $out/bin/modprobe
|
ln -sf kmod $out/bin/modprobe
|
||||||
|
|
||||||
# Copy resize2fs if needed.
|
# Copy resize2fs if any ext* filesystems are to be resized
|
||||||
${optionalString (any (fs: fs.autoResize) fileSystems) ''
|
${optionalString (any (fs: fs.autoResize && (lib.hasPrefix "ext" fs.fsType)) fileSystems) ''
|
||||||
# We need mke2fs in the initrd.
|
# We need mke2fs in the initrd.
|
||||||
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/resize2fs
|
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/resize2fs
|
||||||
''}
|
''}
|
||||||
|
|
|
@ -4,6 +4,7 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
inInitrd = any (fs: fs == "f2fs") config.boot.initrd.supportedFilesystems;
|
inInitrd = any (fs: fs == "f2fs") config.boot.initrd.supportedFilesystems;
|
||||||
|
fileSystems = filter (x: x.fsType == "f2fs") config.system.build.fileSystems;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = mkIf (any (fs: fs == "f2fs") config.boot.supportedFilesystems) {
|
config = mkIf (any (fs: fs == "f2fs") config.boot.supportedFilesystems) {
|
||||||
|
@ -14,6 +15,11 @@ in
|
||||||
|
|
||||||
boot.initrd.extraUtilsCommands = mkIf inInitrd ''
|
boot.initrd.extraUtilsCommands = mkIf inInitrd ''
|
||||||
copy_bin_and_libs ${pkgs.f2fs-tools}/sbin/fsck.f2fs
|
copy_bin_and_libs ${pkgs.f2fs-tools}/sbin/fsck.f2fs
|
||||||
|
${optionalString (any (fs: fs.autoResize) fileSystems) ''
|
||||||
|
# We need f2fs-tools' tools to resize filesystems
|
||||||
|
copy_bin_and_libs ${pkgs.f2fs-tools}/sbin/resize.f2fs
|
||||||
|
''}
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue