Used Truncate Command To Reduce Zpool Storage and Now Facing 'Failed to run: zpool import' #3395

  • Distribution: Ubuntu
  • Distribution version: 20.04
    *Using snapd to mantain LXD 4.0.1 from canonical

Issue description

I used the commands at the bottom of this page:

COMMANDS **
Stop all running containers.
#truncate -s +20G /var/lib/lxd/disks/default.img
#zpool set autoexpand=on default
#zpool status -vg default
4a. Note the device id value from the results (for me, it was a really long number). You’ll need it in the next step.
#zpool online -e default device_id_from_step_4a
#zpool set autoexpand=off default
#service lxd restart
7a. This is on Debian/Ubuntu. For CentOS, it’d be a “systemctl” command.
After service restart, if you do a “$lxc storage info default”, you should now see the ex

*******COMMANDS ***********************
I did this :
truncate -s -5G /var/snap/lxd/common/lxd/disks/default.img
zpool set autoexpand=on default
zpool status -vg default
zpool online -e default 16969932389151116800
zpool set autoexpand=off default

I have received this error:
lxd.daemon[12815]: t=2020-04-30T12:59:37-0400 lvl=eror msg=“Failed to start the daemon: Failed initializing storage pool “default”: Failed to run: zpool import -f -d /var/snap/lxd/common/lxd/disks default: cannot import ‘default’: I/O error”

2020-04-30T16:59:3
Error: Failed initializing storage pool “default”: Failed to run: zpool import -f -d /var/snap/lxd/common/lxd/disks default: cannot import ‘default’: I/O error

Upon running this command, lxd --debug --group lxd, I receive this output

INFO[04-30|13:31:59] LXD 4.0.1 is starting in normal mode path=/var/snap/lxd/common/lxd
INFO[04-30|13:31:59] Kernel uid/gid map:
INFO[04-30|13:31:59] - u 0 0 4294967295
INFO[04-30|13:31:59] - g 0 0 4294967295
INFO[04-30|13:31:59] Configured LXD uid/gid map:
INFO[04-30|13:31:59] - u 0 1000000 1000000000
INFO[04-30|13:31:59] - g 0 1000000 1000000000
INFO[04-30|13:31:59] Kernel features:
INFO[04-30|13:31:59] - netnsid-based network retrieval: yes
INFO[04-30|13:31:59] - uevent injection: yes
INFO[04-30|13:31:59] - seccomp listener: yes
INFO[04-30|13:31:59] - seccomp listener continue syscalls: yes
INFO[04-30|13:31:59] - unprivileged file capabilities: yes
INFO[04-30|13:31:59] - cgroup layout: hybrid
WARN[04-30|13:31:59] - Couldn’t find the CGroup blkio.weight, I/O weight limits will be ignored
WARN[04-30|13:31:59] - Couldn’t find the CGroup memory swap accounting, swap limits will be ignored
INFO[04-30|13:31:59] - shiftfs support: yes
INFO[04-30|13:31:59] Initializing local database
DBUG[04-30|13:31:59] Initializing database gateway
DBUG[04-30|13:31:59] Start database node id=1 address= role=voter
INFO[04-30|13:31:59] Starting /dev/lxd handler:
INFO[04-30|13:31:59] - binding devlxd socket socket=/var/snap/lxd/common/lxd/devlxd/sock
INFO[04-30|13:31:59] REST API daemon:
INFO[04-30|13:31:59] - binding Unix socket socket=/var/snap/lxd/common/lxd/unix.socket
INFO[04-30|13:31:59] Initializing global database
DBUG[04-30|13:31:59] Dqlite: connected address=1 attempt=0
EROR[04-30|13:31:59] Firewall nftables unable to parse existing ruleset: invalid character ‘^’ looking for beginning of value
INFO[04-30|13:31:59] Firewall loaded driver “xtables”
INFO[04-30|13:31:59] Initializing storage pools
DBUG[04-30|13:31:59] Initializing and checking storage pool “default”
DBUG[04-30|13:31:59] Mount started driver=zfs pool=default
DBUG[04-30|13:31:59] Mount finished driver=zfs pool=default
EROR[04-30|13:31:59] Failed to start the daemon: Failed initializing storage pool “default”: Failed to run: zpool import -f -d /var/snap/lxd/common/lxd/disks default: cannot import ‘default’: I/O error
INFO[04-30|13:31:59] Starting shutdown sequence
INFO[04-30|13:31:59] Stopping REST API handler:
INFO[04-30|13:31:59] - closing socket socket=/var/snap/lxd/common/lxd/unix.socket
INFO[04-30|13:31:59] Stopping /dev/lxd handler:
INFO[04-30|13:31:59] - closing socket socket=/var/snap/lxd/common/lxd/devlxd/sock
INFO[04-30|13:31:59] Closing the database
DBUG[04-30|13:32:00] Stop database gateway
INFO[04-30|13:32:00] Unmounting temporary filesystems
INFO[04-30|13:32:00] Done unmounting temporary filesystems
Error: Failed initializing storage pool “default”: Failed to run: zpool import -f -d /var/snap/lxd/common/lxd/disks default: cannot import ‘default’: I/O error