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
This commit is contained in:
Jakub Jirutka 2017-10-11 16:58:42 +02:00
parent 3f25533136
commit d9070c4379

View file

@ -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"