diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 1b06c250..c90dcedb 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -70,6 +70,7 @@ function show_options () { echo " Making this value unnecessarily large will consume extra disk space " echo " on the root partition with extra file system inodes." echo " --min-tmpfs size -- minimum size in GB needed in tmpfs to build the image" + echo " --mkfs-journal-size -- filesystem journal size in MB to pass to mkfs." echo " --mkfs-options -- option flags to be passed directly to mkfs." echo " Options should be passed as a single string value." echo " --no-tmpfs -- do not use tmpfs to speed image build" @@ -149,6 +150,7 @@ while true ; do --image-size) export DIB_IMAGE_SIZE=$2; shift 2;; --image-cache) export DIB_IMAGE_CACHE=$2; shift 2;; --max-online-resize) export MAX_ONLINE_RESIZE=$2; shift 2;; + --mkfs-journal-size) export DIB_JOURNAL_SIZE=$2; shift 2;; --mkfs-options) MKFS_OPTS=$2; shift 2;; --min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;; --no-tmpfs) shift; export DIB_NO_TMPFS=1;; @@ -417,15 +419,21 @@ fi rm -f ${du_output} +if [ -n "$DIB_JOURNAL_SIZE" ]; then + journal_size="$DIB_JOURNAL_SIZE" +else + journal_size=64 +fi + if [ "$DIB_ROOT_FSTYPE" = "ext4" ] ; then # Very conservative to handle images being resized a lot # We set journal size to 64M so our journal is large enough when we # perform an FS resize. - MKFS_OPTS="-i 4096 -J size=64 $MKFS_OPTS" + MKFS_OPTS="-i 4096 -J size=$journal_size $MKFS_OPTS" # Grow the image size to account for the journal, only if the user # has not asked for a specific size. if [ -z "$DIB_IMAGE_SIZE" ]; then - du_size=$(( $du_size + 65536 )) + du_size=$(( $du_size + ($journal_size * 1024) )) fi fi diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index b3d3e64b..299cd953 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -660,6 +660,13 @@ configuration: default can be overridden by passing ``'-i 16384'`` as a ``--mkfs-options`` argument. +``--mkfs-journal-size`` + Only valid for ``FS_TYPE==ext4``. This value set the filesystem + journal size in MB; overriding the default of 64MiB. Note the + image size will be grown to fit the journal, unless + ``DIB_IMAGE_SIZE`` is explicitly set. Can also set + ``DIB_JOURNAL_SIZE``. + ``--max-online-resize`` Only valid for ``FS_TYPE==ext4``; this value sets the maximum filesystem blocks when resizing. Can also set diff --git a/releasenotes/notes/root-journal-size-618e064d6681699a.yaml b/releasenotes/notes/root-journal-size-618e064d6681699a.yaml new file mode 100644 index 00000000..e0971f6e --- /dev/null +++ b/releasenotes/notes/root-journal-size-618e064d6681699a.yaml @@ -0,0 +1,4 @@ +--- +features: + - The ``--mkfs-journal-size`` option is added to override the default + journal size for basic ext4 root partitions.