Hot answers tagged

211

In solving this issue, the information provided at http://www.ivarch.com/blogs/oss/2007/01/resize-a-live-root-fs-a-howto.shtml was pivotal. However, that guide is for a very old version of RHEL, and various information was obsolete. The instructions below are crafted to work with CentOS 7, but they should be easily enough transferable to any distro that runs ...


74

How mature and featureful is LVM RAID? LVM-RAID is actually mdraid under the covers. It basically works by creating two logical volumes per RAID device (one for data, called "rimage"; one for metadata, called "rmeta"). It then passes those off to the existing mdraid drivers. So things like handling disk read errors, I/O load balancing, etc. should be fairly ...


50

A few more steps are needed when mounting an LVM partition vs. a non-LVM partition. sudo apt-get install lvm2 #This step may or may not be required. sudo pvscan #Use this to verify your LVM partition(s) is/are detected. sudo vgscan #Scans for LVM Volume Group(s) sudo vgchange -ay #Activates LVM Volume Group(s) ...


48

These are the steps required to resize an LVM or LVM2 partition: sudo lvresize --verbose --resizefs -L -150G /dev/ubuntu/root sudo pvresize --setphysicalvolumesize {any size here} /dev/sda5 The last command, pvresize, may yield the error /dev/sda5: cannot resize to xxxxx extents as later ones are allocated. You have to rearrange the unallocated space at ...


48

Of course the primary goal is not to have the need to use swap in the first place... The main thing is to create the swap LVM volume when the system is still quite fresh, the same as when you create a swap file, as swap space performs best when it is contiguous, or enforce that with lvcreate -C option. You don't want to actual disk blocks that make up the ...


42

The entries in /dev/mapper are LVM logical volumes. You can think of these as Linux's native partition type. Linux can also use other partition types, such as PC (MBR or GPT) partitions. Your disk is divided in MBR partitions, one of which (/dev/sda2) is an LVM physical volume. The LVM physical volume is the single constituent of the volume group ...


31

From this link: Normally, each LVM command issues a disk scan to find all relevant physical volumes and to read volume group metadata. However, if the metadata daemon is running and enabled, this expensive scan can be skipped ... This can save a significant amount of I/O and reduce the time required to complete LVM operations, particularly on systems ...


30

For newer versions of ubuntu, for example, 14.04, I found a combination of @dragly and this blogposts' answers very helpful. To paraphrase: (On server) Install Dropbear sudo apt-get install dropbear (On server) Copy and assign permissions for root public/private key login sudo cp /etc/initramfs-tools/root/.ssh/id_rsa ~/. sudo chown user:user ~/id_rsa ...


27

One volume group solution: pvcreate /dev/sdb vgextend vg0 /dev/sdb pvmove -n /dev/vg0/bar /dev/sda /dev/sdb Two volume group solution: pvcreate /dev/sdb vgcreate vg1 /dev/sdb lvcreate -l100%FREE vg1 mkfs -t ext4 /dev/vg1/lvol1 mount /dev/vg1/lvol1 /mnt Now difficult part, all activities MUST stop on /bar: cd /mnt ; ( cd /bat ; tar cf - * ) | ...


25

No, having Snap images which consume 100% of their filesystem is perfectly acceptable. In fact, it's supposed to work that way. A snap is a squashfs file carrying content and a bit of metadata that tells the system how to manipulate it. - https://docs.snapcraft.io/snaps/metadata Because Snap uses SquashFS, which is a compressed read-only filesystem, the ...


23

It is not something I would do online but I think it is possible. I guess you are using ext4. umount /home $ umount /home shrink the /home filesystem $ fsck -f /dev/mapper/VolGroup-lv_home $ resize2fs /dev/mapper/VolGroup-lv_home 80G shrink the /home logical volume $ lvreduce -L -40G /dev/mapper/VolGroup-lv_home resize the /home partition to the size ...


22

I ran across the same issue just now, and found another workaround. Basically, it involves making the hosts /run directory available to the guest. First, we mount /run where it can be accessed by the guest. I will assume that your install partition is mounted at /mnt mkdir /mnt/hostrun mount --bind /run /mnt/hostrun Then, we chroot into the guest, and ...


22

The warning messages about the file descriptor leaking are indeed harmless, and are being tracked in bug 592834. You might want to contribute your findings there; I'm not sure Colin (the maintainer) has been able to reproduce the bug in this instance...


22

Same as you would with any other block device. e.g. file -s /dev/vg1/lv1 If /dev/vg1/lv1 is a symbolic link, you'll also need file's -L (aka --dereference) option to de-reference it (i.e. follow it to the real device node it's pointing to): file -L -s /dev/vg1/lv1 BTW, it's OK to use -L on a regular file. If it's ext4, it'll say something like: /dev/vg1/...


21

You have to pay attention to UUIDs . For instance, this is my configuration: # lsblk -o name,uuid,mountpoint ├─sda2 727fa348-8804-4773-ae3d-f3e176d12dac │ └─sda2_crypt (dm-0) P1kvJI-5iqv-s9gJ-8V2H-2EEO-q4aK-sx4aDi │ ├─debian_crypt-swap (dm-1) 3f9f24d7-86d1-4e21-93e9-f3c181d05cf0 [SWAP] │ ├─debian_crypt-tmp (dm-2) ...


21

If you just need another separate filesystem, you don't have to create a new partition: you can create another LVM logical volume within the existing volume group using the unallocated space in the PV. But if you specifically need a new partition, then you must do as you originally planned. GParted is a GUI tool that can do the entire PV + partition ...


20

If you are using lvm and systemd do: systemctl enable lvm2-lvmetad.service systemctl enable lvm2-lvmetad.socket systemctl start lvm2-lvmetad.service systemctl start lvm2-lvmetad.socket BTW this is grub related as well. I think grub gets kernel parameter root from /run/lvm/lvmetad.socket. Wasn't patient to test all this in detail as it worked out to ...


20

Currently [2019] XFS Filesystems can't be shrunk. http://xfs.org/index.php/Shrinking_Support This is what is said on RH website: It is currently not possible to reduce the size of a partition or logical volume with the xfs filesystem. If you are interested in this functionality please contact Red Hat support and reference Red Hat bugzilla 1062667, and ...


19

None of the answers make justice to the power of LVM. (This is based on @frostchutz comment to the question above.) Let's get the facts: OP has two partitions, sdb1 and sdb2 is a physical volume for LVM. sdb1 is ntfs right now, we need to give that space to home logical volume inside linuxvg volume group. LVM steps using the "pragmatic way": ...


19

Does pvcreate /dev/sdb write any metadata to /dev/sdb? if so what is written? Yes, but it's not much more than some header and identification data to mark the block device as an LVM PV. The "real" metadata comes when you create volume groups. Where does vgcreate data /dev/sdb /dev/sdc store configuration of the volume group? On each physical volume that ...


18

Well, that was embarrassing. BTRFS needs to be mounted to be able to resize the partition. How do I resize a partition? (shrink/grow) In order to demonstrate and test the back references, Btrfs devel team has added an online resizer, which can both grow and shrink the filesystem via the btrfs commands. First, ensure that your filesystem is mounted. So, it ...


18

There are actually four different behaviors resize2fs can have (one of them trivial). It depends on if the filesystem is mounted or unmounted and if you're shrinking or extending. Mounted, Extending Here, resize2fs attempts an online resize. More or less, this just tells the kernel to do the work. The kernel then begins writing additional filesystem ...


17

It's not a performance problem, it's a troubleshooting and fixing things problem. /boot is the bootstrap location - in there is a few files that start off everything else in your system. And sometimes you need to poke in there to fix a problem (such as grub config or similar). If you have to do this, it's useful to have a lowest common denominators sort of ...


16

Multiply-claimed blocks are blocks which are used by multiple files, when they shouldn’t be. One consequence of that is that changes to one of those files, in one of the affected blocks, will also appear as changes to the files which share the blocks, which isn’t what you want. (Hard links are a different scenario, which doesn’t show up here.) If there is ...


15

The tool pvs shows the output in whatever units you like. $ pvs PV VG Fmt Attr PSize PFree /dev/sda2 MMB lvm2 a-- 29.69G 6.91G I noticed this mention in the man page: --units hHbBsSkKmMgGtTpPeE All sizes are output in these units: (h)uman-readable, (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes,(t)erabytes, ...


15

Yes when you do the lvremove (warning: this kills the data) on the vg_vpsny23-lv_home volume, the space will become available in the volume group again which will let you do a lvextend on the vg_vpsny23-lv_root volume. In other words: # lvremove /dev/mapper/vg_vpsny23-lv_home # lvextend -l +100%FREE -r /dev/mapper/vg_vpsny23-lv_root # systemctl daemon-reload ...


15

cryptsetup luksDump /dev/fedora/01 shows the LVM logical volume to be a LUKS encrypted volume. The output of pvs or pvdisplay would show the partition /dev/sda3 to be a physical volume. Thus you have LUKS over LVM. At a lower level, you have LVM over PC partition. The output of lsblk confirms this: sda is a disk, sda3 is a partition (which contains an LVM ...


15

You may be able to circumvent the space requirement for this operation by disabling the metadata backup with the -A|--autobackup option: lvextend -An -L+5G /dev/mapper/vg08_root If you do this, follow the operation with a vgcfgbackup to capture the new state. Post-mortem note: Since the ultimate goal was to expand the logical volume and resize the ...


14

As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's possible to do a copy of a logical volume across volume groups using a combination of vgmerge, lvconvert, and vgsplit. Since a move is a combination of a copy and a delete, this will also work for a move. Alternatively, you can use pvmove to move the physical extents instead. To quote U&L: ...


13

What you can do in recent-ish LVM versions is create one “origin” LV on the HDD and one “cache pool” LV on the SSD, and then combine it into a single “cache” LV. It has the same size as the “origin” LV (i.  e., you only get as much space as is on the HDD), but frequently used blocks and metadata are cached on the SSD to improve performance. The gist of it ...


Only top voted, non community-wiki answers of a minimum length are eligible