When working with LVM-based LXC containers, you might encounter an interesting attribute when cloning containers. After running sudo lvs
, you may see output like this:
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
test_lvm containers -wi-a---- 1.00g
u33 containers -wi-ao--- 1.00g
The attributes field in lvs
output consists of several flags that indicate the state of the logical volume. The standard flags are:
- w - writable
- i - inherited allocation policy
- a - active
- o - open (the volume is currently in use)
When you clone an LXC container using lxc-clone
with LVM backend, the new container's logical volume will typically show the 'o' flag because:
- The container is automatically started after cloning
- The logical volume is mounted and in use by the container
Let's examine the state changes through a complete workflow:
# Original container is running
sudo lvs -a containers/test_lvm
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
test_lvm containers -wi-ao--- 1.00g
# Stop the container
sudo lxc-stop -n test_lvm
# Check LVM status again
sudo lvs -a containers/test_lvm
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
test_lvm containers -wi-a---- 1.00g
# Clone the container
sudo lxc-clone -s lvm -B lvm test_lvm u33
# Check the new clone's status
sudo lvs -a containers/u33
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
u33 containers -wi-ao--- 1.00g
The 'o' flag is generally nothing to worry about, but you should investigate if:
- You see the 'o' flag on a volume that shouldn't be in use
- The flag persists after stopping all containers
- You're unable to perform maintenance operations due to the volume being "open"
If you need to verify what's actually using the logical volume:
# Find the device mapper name
sudo dmsetup ls | grep u33
# Check open files on the device
sudo lsof /dev/mapper/containers-u33
# Alternative method using lvdisplay
sudo lvdisplay -m containers/u33
If you're using thin provisioning, the behavior might differ slightly. Here's how to check thin pool status:
sudo lvs -a containers
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
test_lvm containers Vwi-a-tz-- 1.00g pool 0.01
u33 containers Vwi-a-tz-- 1.00g pool 0.01
[pool] containers twi-aotz-- 10.00g 10.22
In this case, the 'o' flag appears on the thin pool itself when it's in use.
When working with LVM-backed LXC containers:
- Always check volume status before maintenance
- Use
lvs -a
for complete information - Consider snapshot-based cloning for faster operations
- Monitor thin pool usage if applicable
When working with LVM-based LXC containers, you might encounter an interesting attribute in lvs
output after cloning containers. Let's examine this specific case:
sudo lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
test_lvm containers -wi-a---- 1.00g
u33 containers -wi-ao--- 1.00g
The attribute field in lvs
output consists of several position-dependent flags. The 'o' flag specifically appears in the 6th position of the attribute string. In LVM terminology, this indicates:
- o: The logical volume is "open" (actively in use by the system)
When you clone an LXC container using lxc-clone
with LVM backend, the new volume is automatically activated (opened) because:
- The container needs immediate access to its storage
- LXC manages the volume activation during clone operation
- The original volume (test_lvm) might not be currently in use
Let's examine the states through command examples:
# Check current volume states
sudo lvchange -an containers/u33
sudo lvs containers/u33 -o lv_name,attr
# Output would show:
# LV Attr
# u33 -wi-a----
And when activated:
sudo lvchange -ay containers/u33
sudo lvs containers/u33 -o lv_name,attr
# Output would show:
# LV Attr
# u33 -wi-ao---
When working with LVM-backed LXC containers:
- Always check volume attributes before operations
- Understand that cloned containers typically activate their storage automatically
- Use
lvs -a
to see all volumes including snapshots
# Comprehensive view command
sudo lvs -a -o +devices,segtype
If you encounter unexpected 'o' attributes:
- Check running containers:
lxc-ls --fancy
- Verify volume activation:
dmsetup info
- Force deactivate if needed:
sudo vgchange -an
The 'o' flag comes from the kernel device-mapper layer. When examining deeper:
# Check device mapper status
sudo dmsetup table
sudo dmsetup status
This shows the actual mapping between LVM volumes and their physical devices, where the open state is maintained at this level.