LVM complaining about device smaller than logical volume

8,009

You need to fix this or you will run into problems later on. The problem is, that the PV is larger than the room you have in /dev/mapper/slackluks. The step lvcreate -l 100%FREE -n root cryptvg # / is not the problem.

What you need to do is:

1) boot form a CD/DVD/USBstick or live-image and do the luksopen

2) make the filesystem / smaller

e2fsck -fy /dev/root-on-the-lv
resize2fs /dev/root-on-the-lv <smaller size>

3) make the LV for root smaller

lvreduce -L -100M /dev/vg/disk-name

4) make the PV smaller with pvresize

I've never done this on LUKS, but it works on 'normal' PV/LV's. However:

  • first backup
  • read the man-pages of all the commands; don't cut-and-past them from this answer
  • be prepared to re-install (and give sizes to the PV and LV's by hand)
Share:
8,009

Related videos on Youtube

dblouis
Author by

dblouis

Updated on September 18, 2022

Comments

  • dblouis
    dblouis almost 2 years

    I just installed Slackware on my laptop, with full disk encryption (LVM on LUKS). It works fine but there is a warning from LVM:

    WARNING: Device /dev/mapper/lukssda2 has size of 115996431 sectors which is
    smaller than corresponding PV size of 115996464 sectors. Was device resized?
    

    Here is how I partitioned the disk:

    mkfs.fat -F32 /dev/sda1 # /boot
    
    cryptsetup luksFormat /dev/sda2
    cryptsetup luksOpen /dev/sda2 slackluks
    
    pvcreate /dev/mapper/slackluks
    vgcreate cryptvg /dev/mapper/slackluks
    lvcreate -L 8G -n swap cryptvg
    lvcreate -l 100%FREE -n root cryptvg # /
    
    mkswap /dev/cryptvg/swap
    

    Should I try to fix it? What did I do wrong?

    • davidgo
      davidgo over 6 years
      Yes, you should try and fix it. My guess is a software error when calculating using "100%FREE" which I've not seen before. I've. came across something similar when going from HDD to an SSD with slightly smaller geometry - can't remember the exact command - it was pvresize or something like that. You might need to get rid of your swap, then resize then recreate a slightly smaller swap.