Add filesystem option to automatically grow to the maximum size

This is primarily for EC2 and other cloud environments, where the disk
may be bigger than the original image.
This commit is contained in:
Eelco Dolstra
2015-09-24 19:59:44 +02:00
parent f40c7ed143
commit 9d92bd7845
5 changed files with 71 additions and 5 deletions
+14 -2
View File
@@ -7,7 +7,7 @@ let
fileSystems = attrValues config.fileSystems;
prioOption = prio: optionalString (prio !=null) " pri=${toString prio}";
prioOption = prio: optionalString (prio != null) " pri=${toString prio}";
fileSystemOpts = { name, config, ... }: {
@@ -43,7 +43,7 @@ let
options = mkOption {
default = "defaults";
example = "data=journal";
type = types.commas;
type = types.commas; # FIXME: should be a list
description = "Options used to mount the file system.";
};
@@ -58,6 +58,17 @@ let
'';
};
autoResize = mkOption {
default = false;
type = types.bool;
description = ''
If set, the filesystem is grown to its maximum size before
being mounted. (This is typically the size of the containing
partition.) This is currently only supported for ext2/3/4
filesystems that are mounted during early boot.
'';
};
noCheck = mkOption {
default = false;
type = types.bool;
@@ -69,6 +80,7 @@ let
config = {
mountPoint = mkDefault name;
device = mkIf (config.fsType == "tmpfs") (mkDefault config.fsType);
options = mkIf config.autoResize "x-nixos.autoresize";
};
};