From 5e2330d89c6c0e55b270464abea7e99a4d3246ad Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 8 Dec 2016 15:59:15 +1100 Subject: [PATCH] Put MKFS_OPTS after filesystem type mkfs's arguments are mkfs [options] [-t type] [fs-options] device [size] So it seems our MKFS_OPTS are really supposed to be fs-options, rather than options to mkfs itself. Why didn't we notice? It's quite a trap -- mkfs.ext2 has a "-t" option, so when we're calling $ mkfs -i 4096 ... -t ext4 ... We actually just fall-back to the default from the mkfs wrapper which is mkfs.ext2 which works! But when you make that, say, xfs, we're not calling the right wrapper at all. Also update documentation Closes-Bug: #1648287 Change-Id: I3ea5807088ab361bd9c235c07fb1553fbaf9178b --- bin/disk-image-create | 2 +- doc/source/user_guide/building_an_image.rst | 25 +++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/disk-image-create b/bin/disk-image-create index 415cbaf9..943cf6c6 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -417,7 +417,7 @@ LOOPDEV=$(sudo losetup --show -f $TMP_IMAGE_PATH) export EXTRA_UNMOUNT="detach_loopback $LOOPDEV" export IMAGE_BLOCK_DEVICE=$LOOPDEV eval_run_d block-device "IMAGE_BLOCK_DEVICE=" -sudo mkfs $MKFS_OPTS -t $FS_TYPE -L ${DIB_ROOT_LABEL} ${IMAGE_BLOCK_DEVICE} +sudo mkfs -t $FS_TYPE $MKFS_OPTS -L ${DIB_ROOT_LABEL} ${IMAGE_BLOCK_DEVICE} # Tuning the rootfs uuid works only for ext filesystems. if echo "$FS_TYPE" | grep -q "^ext"; then sudo tune2fs -U ${DIB_IMAGE_ROOT_FS_UUID} ${IMAGE_BLOCK_DEVICE} diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index 8137fd00..16dccc11 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -58,18 +58,25 @@ formats are: Filesystem Caveat ----------------- -By default, disk-image-create uses a 4k byte-to-inode ratio when creating the -filesystem in the image. This allows large 'whole-system' images to utilize -several TB disks without exhausting inodes. In contrast, when creating images -intended for tenant instances, this ratio consumes more disk space than an -end-user would expect (e.g. a 50GB root disk has 47GB avail.). If the image is -intended to run within a tens to hundrededs of gigabyte disk, setting the -byte-to-inode ratio to the ext4 default of 16k will allow for more usable space -on the instance. The default can be overridden by passing --mkfs-options like -this:: +By default, disk-image-create uses a 4k byte-to-inode ratio when +creating the filesystem in the image. This allows large 'whole-system' +images to utilize several TB disks without exhausting inodes. In +contrast, when creating images intended for tenant instances, this +ratio consumes more disk space than an end-user would expect (e.g. a +50GB root disk has 47GB avail.). If the image is intended to run +within a tens to hundrededs of gigabyte disk, setting the +byte-to-inode ratio to the ext4 default of 16k will allow for more +usable space on the instance. The default can be overridden by passing +``--mkfs-options`` like this:: disk-image-create --mkfs-options '-i 16384' vm +You can also select a different filesystem by setting the ``FS_TYPE`` +environment variable. + +Note ``--mkfs-options`` are options passed to the mfks *driver*, +rather than ``mkfs`` itself (i.e. after the initial `-t` argument). + Speedups -------- If you have 4GB of available physical RAM (as reported by /proc/meminfo