[SOLVED] How to provision a new drive with LVM Thin?

verulian

Well-Known Member
Feb 18, 2019
170
17
58
44
I've installed a new 1 TB SSD into my Proxmox server and have become a bit confused after reviewing the instructions, wiki, etc.

As far as this goes, I would like to have minimal virtual machine storage consumption (ie, I don't want to allocate an entire storage space of 200 GB for a VM initially while I could just use what is needed as it grows possibly up to that point). From what I understand I thought an LVM Thin type storage should be used. I also thought I understood the process to be to create an LVM and then to convert it to a Thin type, etc. This is where I got hung up.

Could someone provide the actual steps for creating such an arrangement to provide a storage device that I can store virtual machine images on in Proxmox 6 that would be growable on an SSD drive like this?
 
Please tell me if the following makes sense. I pulled this from a couple different tutorials, in this case I'm only using /dev/sdb at my 1TB SSD:

fdisk -l # list disks
fdisk -c -u /dev/sdb # create a partition with dos compat off and u gives sectors instead of cylinders, do the following commands inside:
$ n
$ p
$ 1
$ <enter>
$ <enter>
$ t
$ 1
$ 8e
$ p
$ w

fdisk -l # verify drive looks good

pvs # get's physical volume sizes

pvcreate /dev/sdb1 # make the physical volume

vgcreate ssd_vg /dev/sdb1 # create volume group

vgs -v # check things out
vgdisplay ssd_vg # more volume group info

lvcreate -L 900G --chunksize 64K --thinpool ssd_guests ssd_vg
(can remove with: lvremove ssd_vg/ssd_guests)

mkfs.ext4 /dev/ssd_vg/ssd_guests # format ext4

mkdir -p /mnt/ssd_guests # make mount point

mount /dev/ssd_vg/ssd_guests /mnt/ssd_guests # mount it

lvdisplay ssd_vg/ssd_guests # take a look see

#add it to /etc/fstab for automounting at boot:
echo "/dev/ssd_vg/ssd_guests /mnt/ssd_guests ext4 defaults 0 2" >> /etc/fstab
 
I guess the question is that after I create this, how do I get it to show up for storage? I can't seem to get this to show up anywhere to actually USE it now.
 
Unfortunately I found that after reboot and having that line in /etc/fstab the system will not boot. I had to go into single user mode and comment out that line. I even tried to use the UUID insetad of the dev path. It seems that I can mount it fine manually, but automounting it doesn't work. And then of course there's the problem of seeing it in the system too as per above.
 
So I'm still having some trouble here. I found some quite old instructions that were interesting: https://proxmoxve.blogspot.com/2013/12/how-to-add-extra-storage-in-proxmox-ve.html

I deleted my LV "ssd_vg" so that I was back to just a VG of "ssd_vg", but when I went to Datacenter > Storage > Add, I did not see this "ssd_vg" listed in the "Volume group" dropdown - only "pve" is in there.

I am guessing that if Proxmox could detect the VG "ssd_vg" that I made that I could add this as an LVM and THEN maybe be able to create an VM Thin entry from this?

Any additional insight would be wonderful...
 
I found this post: https://forum.proxmox.com/threads/cannot-add-lvm-thin-storage-to-gui.50200/

Which basically says to back out of everything and do this via the Proxmox Web GUI.

So I removed the /etc/pve/storage.cfg entry that I'd tried to make for the thin-lvm, I also issued the following again to wipe out all LVM stuff:
lvremove ssd_vg/ssd_guests
vgremove ssd_vg
pvremove /dev/sdb1
cfdisk /dev/sdb # and I deleted the partition, wrote it and quit
# and rebooted


When I brought the system back up, I went into the node where this is installed and under Disks I found I could go to LVM-Thin and was able to create it from there.

I thought I'd try to examine what was done so I just poked around a bit:
pvs showed the physical volume:
/dev/sdb ssd_guests lvm2 a-- 931.51g 0
vgs showed the volume group:
ssd_guests 1 1 0 wz--n- 931.51g 0
lvs showed the logical volume:
ssd_guests ssd_guests twi-a-tz-- <931.28g 0.00 10.41

I thought it was interesting that Proxmox just names the group and logical the same.

I then checked out /etc/pve/storage.cfg to see what was going on:
lvmthin: ssd_guests
thinpool ssd_guests
vgname ssd_guests
content rootdir,images
nodes pve


I see that "ssd_guests" is now showing up in the Datacenter > Storage tab as "LVM-Thin" for Disk images and Containers. It does not, however, seem to have a Path/Target definition. Should it? I'm not sure how to access it from the shell now if I need to do anything unless I manually mount it.
 
  • Like
Reactions: chevybeef
I found this post: https://forum.proxmox.com/threads/cannot-add-lvm-thin-storage-to-gui.50200/

Which basically says to back out of everything and do this via the Proxmox Web GUI.

So I removed the /etc/pve/storage.cfg entry that I'd tried to make for the thin-lvm, I also issued the following again to wipe out all LVM stuff:
lvremove ssd_vg/ssd_guests
vgremove ssd_vg
pvremove /dev/sdb1
cfdisk /dev/sdb # and I deleted the partition, wrote it and quit
# and rebooted


When I brought the system back up, I went into the node where this is installed and under Disks I found I could go to LVM-Thin and was able to create it from there.

I thought I'd try to examine what was done so I just poked around a bit:
pvs showed the physical volume:
/dev/sdb ssd_guests lvm2 a-- 931.51g 0
vgs showed the volume group:
ssd_guests 1 1 0 wz--n- 931.51g 0
lvs showed the logical volume:
ssd_guests ssd_guests twi-a-tz-- <931.28g 0.00 10.41

I thought it was interesting that Proxmox just names the group and logical the same.

I then checked out /etc/pve/storage.cfg to see what was going on:
lvmthin: ssd_guests
thinpool ssd_guests
vgname ssd_guests
content rootdir,images
nodes pve


I see that "ssd_guests" is now showing up in the Datacenter > Storage tab as "LVM-Thin" for Disk images and Containers. It does not, however, seem to have a Path/Target definition. Should it? I'm not sure how to access it from the shell now if I need to do anything unless I manually mount it.
Thanks for this it was most useful. I was trying all sorts of things until I reverted disk changes, went to the node, LVM-Thin and Create.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!