From 902250d75fd2141e33776ed58e2d984f36eb3f20 Mon Sep 17 00:00:00 2001 From: Wesley Hershberger Date: Tue, 3 Dec 2024 21:25:34 -0600 Subject: [PATCH] doc: Add root volume attachment to storage volume how-to Signed-off-by: Wesley Hershberger --- doc/.custom_wordlist.txt | 1 + doc/howto/storage_volumes.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/doc/.custom_wordlist.txt b/doc/.custom_wordlist.txt index fefecea889ab..5ec4d93402f0 100644 --- a/doc/.custom_wordlist.txt +++ b/doc/.custom_wordlist.txt @@ -303,6 +303,7 @@ uptime URI URIs userspace +UUIDs vCPU vCPUs VDPA diff --git a/doc/howto/storage_volumes.md b/doc/howto/storage_volumes.md index 2dc1ad52174c..e57c7fd102e6 100644 --- a/doc/howto/storage_volumes.md +++ b/doc/howto/storage_volumes.md @@ -179,6 +179,34 @@ For example, to set the default volume size for `my-pool`, use the following com lxc storage set my-pool volume.size=15GiB +## Attach instance root volumes to other instances +Virtual-machine root volumes can be attached as disk devices to other virtual machines. +In order to prevent concurrent access, `security.protection.start` must be set on +an instance before its root volume can be attached to another virtual-machine. + +```{caution} +Because instances created from the same image share the same partition and file system +UUIDs and labels, booting an instance with two root file systems mounted may result +in the wrong root file system being used. This may result in unexpected behavior +or data loss. **It is strongly recommended to only attach virtual-machine root +volumes to other virtual machines when the target virtual-machine is running.** +``` + +Assuming `vm1` is stopped and `vm2` is running, attach the `virtual-machine/vm1` storage +volume to `vm2`: + + lxc config set vm1 security.protection.start=true + lxc storage volume attach my-pool virtual-machine/vm1 vm2 + +`virtual-machine/vm1` must be detached from `vm2` before `security.protection.start` +can be unset from `vm1`: + + lxc storage volume detach my-pool virtual-machine/vm1 vm2 + lxc config unset vm1 security.protection.start + +`security.shared` can also be used on `virtual-machine` volumes to enable concurrent +access. Note that concurrent access to block volumes may result in data loss. + ## Resize a storage volume If you need more storage in a volume, you can increase the size of your storage volume.