[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] Hierarchical local mount



Hello everyone!

I have to implement the functionality of mounting all VM disks/partitions.

E.g. if a VM has 2 disks of 2 partitions each (I get it from virt-filesystems), I want to get the following structure on host node after mount:
mnt/
------hdd0/
-------------volume1/
-------------volume2/
------hdd1/
-------------volume1/
-------------volume2/

I'd like to use guestmount due to syntax simplicity, but I found out that it's impossible to call e.g. guestmount -a disk.qcow2 -m /dev/sda1:/hdd0/volume1 -m /dev/sda2:/hdd0/volume2 mnt/

So I came to only two possible options:
1)
mkdir -p mnt/hdd0/volume1
guestmount -a disk.qcow2 -m /dev/sda1 mnt/hdd0/volume1
....
(Is it safe to use the same disk from multiple guestmounts?)

2)
guestfish -a disk.qcow2 "
run :
mkmountpoint /hdd0 :
mkmountpoint /hdd0/volume1 :
... :
mount /dev/sda1 /hdd0/volume1 :
... :
mount-local mnt/ :
mount-local-run"

kill -TERM `pidof guestfish`
guestunmount mnt/


Is any of these options safe enough/preferred? Or, maybe, other options?
I'd like to avoid guestfs API, threading and so on, and confine myself to command-line.

Thanks in advance!

--
Your sincerely,
Maxim Perevedentsev


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]