Easy way to transfer files between host and LXC container on LVM

Revised answer: LXC containers share the same kernel as the host, so any filesystem they mount should be accessible from outside. If you do a cat /proc/mounts on the host, can you see the container filesystems? If you see a line like /dev/mapper/… /var/lib/lxc/o1/rootfs ext4 … then you should be able to access /var/lib/lxc/o1/rootfs from … Read more

How to recover logical volume deleted with lvremove

LVM does backup it’s metadata to /etc/lvm/backup and /etc/lvm/archive. At the top of each file it will tell you the time/data when the file was generated so chances are you’ll have a copy of the older metadata as it was before you deleted the LV. I believe the backup is automatic anytime the metadata changes. … Read more

Logical volume attributes

The meaning of the o in the output of lvs is described in its manpage, under the lv_attrs attributes section: 6 device (o)pen Basically this means the device has been mounted.

Moving a Logical Volume directly from one server to another over the network?

Sure, of course it’s possible. dd if=/dev/mygroup-mylv | ssh 192.168.1.103 dd of=/dev/newvgroup-newlv Boom. Do yourself a favor, though, and use something larger than the default blocksize. Maybe add bs=4M (read/write in chunks of 4 MB). You can see there’s some nitpicking about blocksizes in the comments; if this is something you find yourself doing fairly … Read more

How can I tell pvresize to expand a physical volume to include all available space?

As yoonix pointed out in the comment, the pvresize without options resizes physical volume to the size the operating system reports for the underlying partition. pvresize /dev/sdXY –setphysicalvolumesize option can be used to shrink the physical volume or to override the operating system autodetected size (if for some reason is wrong). To extend a logical … Read more

Can’t remove open logical volume

What does the logical volume contain? Is it a filesystem (I accidentally wrote partition)? Could it be it’s mounted? In that case: umount /dev/my-volumes/volume-1 Does it have any active snapshots? Edit: try lvchange -an -v /dev/my-volumes/volume-1 and lvremove -vf /dev/my-volumes/volume-1. Edit 2: please post ‘lvs’. Edit 3: Try this with some other problematic volume. It’s … Read more