From d9070c4379711e41865db46d083a24805b1b1265 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Wed, 11 Oct 2017 16:58:42 +0200 Subject: [PATCH] Do not discard blocks on NBD image when creating FS It's useless for NBD image and probably causes the following error: > Formatting image to ext4 mke2fs 1.43.4 (31-Jan-2017) Discarding device blocks: 4096/1310720 failed - I/O error --- alpine-make-vm-image | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alpine-make-vm-image b/alpine-make-vm-image index 5307f83..6920df3 100755 --- a/alpine-make-vm-image +++ b/alpine-make-vm-image @@ -287,8 +287,10 @@ nbd_dev=$(attach_image "$IMAGE_FILE" "$IMAGE_FORMAT") #----------------------------------------------------------------------- einfo "Formatting image to $ROOTFS" -# syslinux 6.0.3 cannot boot from ext4 w/ 64bit feature enabled -[ "$ROOTFS" = ext4 ] && mkfs_args='-O ^64bit' || mkfs_args='' +# syslinux 6.0.3 cannot boot from ext4 w/ 64bit feature enabled. +# -E nodiscard / -K - do not attempt to discard blocks at mkfs time (it's +# useless for NBD image and prints confusing error). +[ "$ROOTFS" = ext4 ] && mkfs_args='-O ^64bit -E nodiscard' || mkfs_args='-K' mkfs.$ROOTFS -L root $mkfs_args "$nbd_dev"