I have my rootfs snapshot in /mnt/mydisk/my_test_snapshot. It is completely writable copy of my current system. I want to boot a virtual machine (possibly an LXC container or maybe something else) that will use /mnt/mydisk/my_test_snapshot as its root (/) folder.  At the end, I need to boot a virtual machine that: uses a regular folder as its root filesystem. can mount some permitted folders in its virtual environmentwill use bridged networking (with zero configuration on the host's iptables)hopefully will have a X window to use GUI applications withinIs there any LXC recipe (or something else) for that purpose? PurposeIt might be re-inventing Docker or something, I don't know, but I need the following good bits: As using BTRFS for the root partition, we can take a snapshot of current system with no cost and boot a virtual machine and play around (by installing new software, deleting something etc...)If we liked what we did in the virtual machine, we can boot our real operating system from that snapshot (modified by VM)We can clone any VM with no cost (time, cpu or disk space)We can use this virtual machine as a time machine, for example, that will serve a database server from a backup. Good part is we can bring all services online in 1 minute and at once. Good for disaster recovery. We can use it for specific applications (that we use for business) that will has to run any time we need, no matter what kind of upgrade or operating system change we did. This will completely create a sandbox for each application, without the cost of disk space and will bring BTRFS benefits (like snapshotting etc.)
How to boot a virtual machine from a regular folder?
virtual machine;lxc
As a partial answer, I created the following tool to create an LXC container from a subvolume: https://github.com/aktos-io/lxc-to-the-futureif [[ $(grep br0 /etc/network/interfaces) ==  ]]; then     cat <<ONETIMEERROR: No br0 bridge device found in  /etc/network/interfaces file. Edit your /etc/network/interfaces file and add/replace the following section in place of eth0 section     auto br0    iface br0 inet dhcp        bridge-ifaces eth0        bridge-ports eth0        up ifconfig eth0 up    iface eth0 inet manualThen run the following:     sudo ifup br0ONETIME    exitfiecho creating the container directory: $NAMEmkdir $DIR/$NAMEecho creating a writable snapshot of given subvolumebtrfs sub snap $SUBVOL $DIR/$NAME/rootfsecho emptying the /etc/fstab fileecho > $DIR/$NAME/rootfs/etc/fstabecho creating the config filecat <<CONFIG > $DIR/$NAME/config# Distribution configurationlxc.include = /usr/share/lxc/config/debian.common.conflxc.arch = x86_64# Container specific configurationlxc.rootfs = /var/lib/lxc/$NAME/rootfslxc.rootfs.backend = dirlxc.utsname = $NAME# Network configurationlxc.network.type = vethlxc.network.link = br0lxc.network.hwaddr = 00:16:3e:7e:11:aclxc.network.flags = up CONFIG