LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-11-2020, 03:56 PM   #1
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
More LVM issues


Encrypted LVM installation on Debian 10 (Buster)

I've been reading lots of docs, but I've been unable to solve my current issue. I have plenty of space on my internal SSD, and I want to remove the SD card that is part of the root volume. I formatted the entire SSD as an LVM volume, so there is no space left on it outside the volume. The system insists that there are extents on the SD card that are in use, and there may well be. I've tried using pvmove but there are no extents available for allocation.
Code:
root@chromebox:/home/stan# pvmove /dev/sdc1
  No extents available for allocation.
root@chromebox:/home/stan# pvdisplay
  --- Physical volume ---
  PV Name               /dev/mapper/sda5_crypt
  VG Name               chromebox-vg
  PV Size               <118.99 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              30460
  Free PE               0
  Allocated PE          30460
  PV UUID               gIr9xa-CrBR-7e9g-TZBT-y0ne-VSpe-5gNna3
   
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               chromebox-vg
  PV Size               <117.32 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              30033
  Free PE               0
  Allocated PE          30033
  PV UUID               9GGAaS-62jT-y053-5zMU-nnff-26oO-HXYqKC
   
root@chromebox:/home/stan# 
root@chromebox:/home/stan# vgdisplay
  --- Volume group ---
  VG Name               chromebox-vg
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               236.30 GiB
  PE Size               4.00 MiB
  Total PE              60493
  Alloc PE / Size       60493 / 236.30 GiB
  Free  PE / Size       0 / 0   
  VG UUID               TBjew3-h2m8-drWJ-tA10-ilQ6-uJCH-RxaU2J
   
root@chromebox:/home/stan# vgs
  VG           #PV #LV #SN Attr   VSize   VFree
  chromebox-vg   2   3   0 wz--n- 236.30g    0 
root@chromebox:/home/stan#
How can I get the extents on the SD moved to the internal drive? Resize the internal volume? Buster removed the GUI tools, and my LVM experience is rather new and limited.
 
Old 08-11-2020, 05:20 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
If they won't fit, they won't fit. This is now the second thread where you haven't shown the relevant info as asked for there. Start with this - uneditted. The reason will likely jump out at you.
Code:
df -hT
 
Old 08-11-2020, 05:28 PM   #3
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Original Poster
Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Sorry, but the answer isn't jumping out. I don't know enough about LVM to know everything that's relevant, but I'm trying to learn.
Code:
stan@chromebox:~$ df -hT
Filesystem                     Type      Size  Used Avail Use% Mounted on
udev                           devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                          tmpfs     389M   42M  347M  11% /run
/dev/mapper/chromebox--vg-root ext4      143G   22G  116G  16% /
tmpfs                          tmpfs     1.9G  136M  1.8G   7% /dev/shm
tmpfs                          tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs                          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1                      ext2      236M  137M   87M  62% /boot
/dev/mapper/chromebox--vg-home ext4       86G   20G   62G  24% /home
tmpfs                          tmpfs     389M   24K  389M   1% /run/user/1000
/dev/mapper/veracrypt1         ext4      2.0G   40M  1.8G   3% /media/veracrypt1
/dev/mapper/veracrypt2         ext4      1.1G   37M  925M   4% /media/veracrypt2
/dev/sdd1                      ext4      688G  187G  466G  29% /media/stan/USB3_HDD
/dev/sdb1                      ext4      914G  187G  681G  22% /media/stan/ExtremeSSD
/dev/sde1                      btrfs     233G  186G   47G  80% /media/stan/passport
 
Old 08-11-2020, 05:35 PM   #4
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Original Poster
Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
FWIW
Code:
stan@chromebox:~$ lsblk
NAME                       MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                          8:0    0 119.2G  0 disk  
├─sda1                       8:1    0   243M  0 part  /boot
├─sda2                       8:2    0     1K  0 part  
└─sda5                       8:5    0   119G  0 part  
  └─sda5_crypt             254:0    0   119G  0 crypt 
    ├─chromebox--vg-root   254:1    0 145.3G  0 lvm   /
    ├─chromebox--vg-swap_1 254:2    0     4G  0 lvm   [SWAP]
    └─chromebox--vg-home   254:3    0  87.1G  0 lvm   /home
sdb                          8:16   0 931.5G  0 disk  
├─sdb1                       8:17   0 929.5G  0 part  /media/stan/ExtremeSSD
└─sdb2                       8:18   0     2G  0 part  
  └─veracrypt1             254:4    0     2G  0 dm    /media/veracrypt1
sdc                          8:32   1 118.4G  0 disk  
├─sdc1                       8:33   1 117.3G  0 part  
│ └─chromebox--vg-root     254:1    0 145.3G  0 lvm   /
└─sdc2                       8:34   1   1.1G  0 part  
  └─veracrypt2             254:5    0   1.1G  0 dm    /media/veracrypt2
sdd                          8:48   0 698.7G  0 disk  
└─sdd1                       8:49   0 698.7G  0 part  /media/stan/USB3_HDD
sde                          8:64   0 232.9G  0 disk  
└─sde1                       8:65   0 232.9G  0 part  /media/stan/passport
 
Old 08-11-2020, 06:10 PM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by sgosnell View Post
Code:
root@chromebox:/home/stan# vgs
  VG           #PV #LV #SN Attr   VSize   VFree
  chromebox-vg   2   3   0 wz--n- 236.30g    0 
root@chromebox:/home/stan#
How can I get the extents on the SD moved to the internal drive? Resize the internal volume? Buster removed the GUI tools, and my LVM experience is rather new and limited.
Since all extents on the internal drive are used, you can't move anything to the internal drive.

Only solution: Deallocate extents by deallocating volumes or reducing volume sizes. Both the root and the home volume have great potential for shrinking. Boot from a DVDROM or USB stick then lvreduce -r.

Last edited by berndbausch; 08-11-2020 at 06:14 PM.
 
2 members found this post helpful.
Old 08-11-2020, 06:21 PM   #6
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Original Poster
Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Yes, that's probably the only option. I've been hesitant to start mucking around with the LVM utilities, for fear of irreversible errors. It works now, but having the SD card in there isn't ideal. I should have left room on both disks at the start, but it's too late now. The biggest issue right now is really the inability to do a snapshot and backup, because that seems to require free extents also. At least I'm starting to learn a little about LVM, which I've actively avoided in the past.
 
Old 08-11-2020, 06:40 PM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,894

Rep: Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014
Looks like you've painted yourself into a corner.

You'll likely need to shrink both /home and the rootfs in order make them both fit on the ssd, then you'll have to shrink the lvs that they sit on. Once that's done you can then pvmove them onto the ssd only and finally vgreduce sdc1 from the volume group. Shrinking active filesystems is a no-go so you'll have to use a live-cd, unlock the luks container and activate the vg before you can do any of that.

That's a lot of involved, error prone, high risk, messing about for someone of your skill level. You may be better off just starting over.

edit: I forgot about lvreduce -r. Never used it myself, last time I did this I had to resize2fs and then lvresize. Perhaps its not as bad as it used to be.

Last edited by GazL; 08-11-2020 at 07:08 PM.
 
Old 08-11-2020, 07:29 PM   #8
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Thumbs up

Quote:
Originally Posted by sgosnell View Post
I've been hesitant to start mucking around with the LVM utilities, for fear of irreversible errors.
LVM is both very robust and, in my opinion, easy to use. Set up a few physical volumes and experiment with them.

How can you set up physical volumes on a system that is already full? Either find a USB drive where you create two or more partitions, or create loop devices on your root filesystem:
Code:
dd if=/dev/zero of=pv0 bs=1M count=1024
dd if=/dev/zero of=pv1 bs=1M count=1024
losetup pv1   # creates a loop device, e.g. /dev/loop0
losetup pv2   # creates a loop device, e.g. /dev/loop1
pvcreate /dev/loop[01]
vgcreate experimentalvg /dev/loop[01]
Find an LVM tutorial and enjoy.
 
Old 08-11-2020, 07:31 PM   #9
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Or use the gparted live disk. I have not tried it, but it seems to support LVM: https://gparted.org/features.php.
 
Old 08-11-2020, 09:03 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,774

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
pvmove isn't the right tool for this, at least not yet. What you need to do is run lvreduce to reduce the size of the vg-root LV to just the 30460 extents that are currently allocated on the SSD. Use the --resizefs option to adjust the filesystem size concurrently. You will have to do this offline since onlline shrinking of the filesystem is not supported.

After the lvreduce, check the resulting allocations with pvdisplay. If any of the extents of vg-root are still on the SD card, you can use pvmove to move them to the SSD, which should now have the needed free extents to receive them. Once all the extents are on the SSD, you can then remove /dev/sdc1 from the volume group.
 
1 members found this post helpful.
Old 08-11-2020, 09:15 PM   #11
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Original Poster
Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Well, pvmove is very slow, but it appears that it's going to be successful. The pointer to lvreduce -r is what I needed. Thanks a lot. I may resist the urge to use LVM on my next install, which I hope will be far in the future. All I really wanted was an encrypted filesystem, and that seemed to be a quick and easy way to get it. I need to do some more reading. Anyway, thanks for the help.
 
Old 08-11-2020, 09:27 PM   #12
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Original Poster
Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
I suspect rknichols' advice would have been the best way to go, but I didn't see it until I was past committed. I reduced the vg-root, but not by that much, then started pvmove, and it's too late now. But in hindsight, that would have been a better way. But I learned something today, so it's a good day, and I endeavor to persevere.
 
Old 08-11-2020, 09:31 PM   #13
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Original Poster
Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Quote:
LVM is both very robust and, in my opinion, easy to use.
So is Linux, once I learned by reading and making mistakes. It's all easy if you have sufficient exerience. I've just had little use for LVM, so I didn't bother to deal with it. I need to make some volumes as you suggested and play with it. I've been looking at tutorials for several days. Not much else to do these days anyway.

Last edited by sgosnell; 08-11-2020 at 09:33 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: More Linux Phones, More Mint Hack & Just Plain More… LXer Syndicated Linux News 0 02-27-2016 09:12 PM
Drive issues or LVM issues? Barefootpanda Linux - Hardware 1 10-23-2008 02:27 PM
Possible to change non-LVM to LVM? darthfoolish Linux - Software 2 08-01-2008 03:47 AM
LXer: Google's Knol: More Rules, More Accountability, More Money LXer Syndicated Linux News 0 07-25-2008 04:11 AM
To LVM or not to LVM? illtbagu Linux - Software 3 12-29-2003 04:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration