Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: sharing files with a VM

  1. #1
    Join Date
    Jan 2010
    Location
    Wheeling WV USA
    Beans
    1,523
    Distro
    Xubuntu 18.04 Bionic Beaver

    sharing files with a VM

    i would like to know if there is any setup which makes it easy to run Linux guested VMs with its root filesystem(s) (/etc, /bin, /usr, and so on) shared from the host system, not as a block device or loopback device. usually this will mean NFS. but i am hoping there are now things like emulation of devices sourced without NFS or small commonly usable images to bring up a guest that the uses NFS. i'm just looking around for possibly new stuff in the past 8 years since i did virtualization. otherwise i'll just spend the time to piece it together, myself.

    my goal is to set up several VMs i can run in the background with no GUI except via VNC connections (when i want to be on, not required to bring a guest up). they will be started in CLIs under screen (which i use for just about all my background stuff). they will, in most cases, be there to test things under different distros and/or versions.
    What do you call someone who speaks 3 languages? Trilingual.
    What do you call someone who speaks 2 languages? Bilingual.
    What do you call someone who speaks 1 language? American.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: sharing files with a VM

    Not sure I understand but sheepdog is a storage cluster solution for KVM. There are others.

    The goal you have mentioned is something that virsh does all the time .... though you don't need screen. virsh uses libvirt and a client/server connection. Not sure what having shared critical file systems has to do with this. Most distros have slightly different needs for the files in /usr, /bin, and /etc/. If they are identical, then only /var/ and /etc/ have to be unique, sharing of /bin and /usr is fine. At least that's how I interpret the FHS. /etc is tiny, so it usually isn't a big deal to have it on local storage. But only you know the specific situation.

  3. #3
    Join Date
    Jan 2010
    Location
    Wheeling WV USA
    Beans
    1,523
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: sharing files with a VM

    the reason i want to share files between host and guest is so i can readily change things when all the VMs are down, which could very often include parts of /etc. yes, that can involve some executables runnable as root on both. but i will be the only one doing that. i do trust me, myself, and i, with root powers.
    What do you call someone who speaks 3 languages? Trilingual.
    What do you call someone who speaks 2 languages? Bilingual.
    What do you call someone who speaks 1 language? American.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: sharing files with a VM

    A few options now that I understand the real goal.

    If the VMs are off, it is possible to mount the storage from the host.
    https://www.jamescoyle.net/tag/qemu-nbd is one method for qcow2 VM storage.

    Use mount -o loop with raw image VM storage. I remember having to use an offset last time I did it.

  5. #5
    Join Date
    Sep 2012
    Beans
    579
    Distro
    Ubuntu Gnome 17.04 Zesty Zapus

    Re: sharing files with a VM

    Suggest you look into containers (https://linuxcontainers.org) rather than a traditional VMs. Low latency, images for different distros (https://us.images.linuxcontainers.org), all guest filestorage is file-by-file on host, different toolset options for managing via cli (ubuntu pushes LXD https://lxd.readthedocs.io/en/latest/).

  6. #6
    Join Date
    Jan 2010
    Location
    Wheeling WV USA
    Beans
    1,523
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: sharing files with a VM

    Quote Originally Posted by KillerKelvUK View Post
    Suggest you look into containers (https://linuxcontainers.org) rather than a traditional VMs. Low latency, images for different distros (https://us.images.linuxcontainers.org), all guest filestorage is file-by-file on host, different toolset options for managing via cli (ubuntu pushes LXD https://lxd.readthedocs.io/en/latest/).
    do i have to use a prebuilt image with containers or can i start empty and boot an ISO or USB stick image and my own install.

    i need to go way back to unsupported versions of several distros. probably to 10.04 for Ubuntu.

    if filestorage is file-by-file on the host, how are these prebuilt images used? will they be there file-by-file when i boot up the container? can i modify those files before booting? i do plan on keeping the changes in SVN or HG so i can just pick a revision when i need to.
    What do you call someone who speaks 3 languages? Trilingual.
    What do you call someone who speaks 2 languages? Bilingual.
    What do you call someone who speaks 1 language? American.

  7. #7
    Join Date
    Jan 2010
    Location
    Wheeling WV USA
    Beans
    1,523
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: sharing files with a VM

    Quote Originally Posted by TheFu View Post
    A few options now that I understand the real goal.

    If the VMs are off, it is possible to mount the storage from the host.
    https://www.jamescoyle.net/tag/qemu-nbd is one method for qcow2 VM storage.

    Use mount -o loop with raw image VM storage. I remember having to use an offset last time I did it.
    and umount, too.

    i've already done this with NFS and am looking to find a way forward from that.
    What do you call someone who speaks 3 languages? Trilingual.
    What do you call someone who speaks 2 languages? Bilingual.
    What do you call someone who speaks 1 language? American.

  8. #8
    Join Date
    Sep 2012
    Beans
    579
    Distro
    Ubuntu Gnome 17.04 Zesty Zapus

    Re: sharing files with a VM

    Quote Originally Posted by Skaperen View Post
    do i have to use a prebuilt image with containers or can i start empty and boot an ISO or USB stick image and my own install.

    i need to go way back to unsupported versions of several distros. probably to 10.04 for Ubuntu.

    if filestorage is file-by-file on the host, how are these prebuilt images used? will they be there file-by-file when i boot up the container? can i modify those files before booting? i do plan on keeping the changes in SVN or HG so i can just pick a revision when i need to.
    I believe you can create your own container images although I never have.

    Regards storage...the management layer i.e. LXD allows different storage solution but, for example if you choose local disk the the prebuilt images are simply cached locally and unpacked to your local disk per container you create, you can then go an modify these files offline.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: sharing files with a VM

    The best practice for using containers doesn't include treating them like complete OSes. They only have enough OS to perform the specific task. No ssh. No shells. All config management happens outside the container.

    Containers should be treated like Zombies. As soon as they don't do what you want, you shoot it in the head and build a fresh one that does do what you want. Also, most containers shouldn't have any data. They are service providers. Data should be stored elsewhere.

    I wouldn't compare access via NFS to access via qemu-nbd. One is a network protocol and the other is direct access.

  10. #10
    Join Date
    Jan 2010
    Location
    Wheeling WV USA
    Beans
    1,523
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: sharing files with a VM

    i'm not implying that NFS is direct access. but it can be host access by setting up NFS export on the host and specify the host IP in the NFS boot specification for the guest. i don't know (yet) how the direct access files show up in the guest (e.g where mounted from). i have only used qemu for VM operation, before, and that was back before 64-bit came out. i have used instances on the xen-based AWS EC2 cloud (made custom AMIs, some derived from existing AMIs, some built from scratch). i have also built embedded images for multiple architectures. my prior VM experience was on IBM mainframes before Linux existed.
    What do you call someone who speaks 3 languages? Trilingual.
    What do you call someone who speaks 2 languages? Bilingual.
    What do you call someone who speaks 1 language? American.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •