hot-plugging disks to a VM

Nikos Vassiliadis nvass at
Sat Aug 1 17:14:12 UTC 2015


I was thinking of creating a HAST disk and using that as second
disk to a VM. It seems that when the backing file is gone and
returned, it's never re-opened. Is this scenario possible?

Host machine:
> root at moby:~/VMs # diskinfo /dev/hast/shared
> /dev/hast/shared        512     21474830848     41943029        0       0

and from withing the VM:
> root at lamb:~ # diskinfo /dev/vtbd2
> /dev/vtbd2      512     21474830848     41943029        0       0
> root at lamb:~ # file -s /dev/vtbd2
> /dev/vtbd2: Unix Fast File system [v2] (little-endian) last mounted on /mnt, last written at Sat Aug  1 19:33:17 2015, clean flag 0, readonly flag 0, number of blocks 5242878, number of data blocks 5076797, number of cylinder groups 33, block size 32768, fragment size 4096, average file size 16384, average number of files in dir 64, pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization

Then I go to the host, destroy /dev/hast/shared and re-create it.
The VM is not able to use the disk anymore:
> root at lamb:~ # file -s /dev/vtbd2
> vtbd2: hard error cmd=read 0-255
> /dev/vtbd2: ERROR: cannot read `/dev/vtbd2' (Input/output error)

Is this possible? Can I somehow achieve hot-plugging a disk?

Thanks for any thoughts,

More information about the freebsd-virtualization mailing list