How to sync files from a file as block device attached to another qube?

46 views
Skip to first unread message

SideRealiq

unread,
Jun 2, 2019, 12:03:21 PM6/2/19
to qubes...@googlegroups.com
If I create a loopback device in vm1 and attach it to vm2, any changes in vm1 device are not reflected in the attached vm2 device. Why is that and how can they be reflected/synced?

Here is my test code:
# in vm1
sudo losetup -f --show ~/loopfile.img
## result: /dev/loop2
sudo mkdir /mnt/loopmnt

# in vm2
sudo mkdir /mnt/loopmnt

# in dom0
qvm-block
## result: vm1:loop2 /home/user/loopfile.img

qvm-block attach vm2 vm1:loop2
qvm-block
## result: vm1:loop2 /home/user/loopfile.img b(frontend-dev=xvdi, read-only=no)

qvm-run -u root -p vm1 'mount /dev/loop2 /mnt/loopmnt'
qvm-run -u root -p vm2 'mount /dev/loop2 /mnt/loopmnt'

# in vm1
cd /mnt/loopmnt
# create a new file and verify it is there

# in vm2
ls -al /mnt/loopmnt
# the changes from vm1 are not reflected.

David Hobach

unread,
Jun 3, 2019, 6:09:12 AM6/3/19
to SideRealiq, qubes...@googlegroups.com
As I've said in the other thread:

Mounting the same device two times in different VMs is a bad thing to do
as it'll not work in the best case (apparently above) and result in data
corruption in the worst.

One device should only be mounted inside a single VM unless it's some
special networking file system (e.g. nfs), but even then it's not meant
to be used with qvm-block, but over the network...

Reply all
Reply to author
Forward
0 new messages