Add new hard drive (LVM) in Bullseye - excluded by a filter

Getting your soundcard to work, using Debian on non-i386 hardware, etc

Add new hard drive (LVM) in Bullseye - excluded by a filter

Postby GabrieleMax » 2020-06-17 19:08

Hi guys,

I inserted another disk on my home server, now I have two WD 500gb:

Code: Select all
root@Server01:~# lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
fd0                       2:0    1     4K  0 disk
sda                       8:0    0 465,8G  0 disk
└─sda1                    8:1    0 465,8G  0 part
sdb                       8:16   0 465,8G  0 disk
├─sdb1                    8:17   0   243M  0 part /boot
├─sdb2                    8:18   0     1K  0 part
└─sdb5                    8:21   0 465,5G  0 part
  ├─Server01--vg-root   254:0    0  23,3G  0 lvm  /
  ├─Server01--vg-swap_1 254:1    0   1,3G  0 lvm  [SWAP]
  ├─Server01--vg-var    254:2    0   9,3G  0 lvm  /var
  ├─Server01--vg-tmp    254:3    0   1,9G  0 lvm  /tmp
  └─Server01--vg-home   254:4    0 429,8G  0 lvm  /home


I followed this guide https://www.cyberciti.biz/faq/howto-add ... e-of-pool/ and I tried:

Code: Select all
root@Server01:~# pvcreate /dev/sda
  Device /dev/sda excluded by a filter.


I searched on internet but... I didn't find a solution... :\

GabrieleMax
GabrieleMax
 
Posts: 92
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby GabrieleMax » 2020-06-17 19:30

GabrieleMax wrote:
Code: Select all
root@Server01:~# pvcreate /dev/sda
  Device /dev/sda excluded by a filter.


I searched on internet but... I didn't find a solution... :\

GabrieleMax


I found the solution here https://www.simplstor.com/index.php/sup ... -by-filter
GabrieleMax
 
Posts: 92
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby p.H » 2020-06-17 20:38

Another (and better IMO) solution was to use the partition /dev/sda1 instead of the whole disk /dev/sda as the PV.
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby GabrieleMax » 2020-06-18 19:18

p.H wrote:Another (and better IMO) solution was to use the partition /dev/sda1 instead of the whole disk /dev/sda as the PV.


I'm new in LVM and (maybe) you understood it, I'm following guides to understand how to extend LVM to another HD, I think I found a good guide here: https://www.linuxsysadmins.com/fdisk-to ... -in-linux/

Code: Select all
root@Server01:~# lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
fd0                       2:0    1     4K  0 disk
sda                       8:0    0 465,8G  0 disk
sdb                       8:16   0 465,8G  0 disk
├─sdb1                    8:17   0   243M  0 part /boot
├─sdb2                    8:18   0     1K  0 part
└─sdb5                    8:21   0 465,5G  0 part
  ├─Server01--vg-root   254:0    0  23,3G  0 lvm  /
  ├─Server01--vg-swap_1 254:1    0   1,3G  0 lvm  [SWAP]
  ├─Server01--vg-var    254:2    0   9,3G  0 lvm  /var
  ├─Server01--vg-tmp    254:3    0   1,9G  0 lvm  /tmp
  └─Server01--vg-home   254:4    0 429,8G  0 lvm  /home


I don't understand what is the best way to do it, I'd like to write in my mind a step by step guide like:

1) Add new disk
2) Create new partitions, why should I create primary, extended and logical partitions?
3) Extend partitions https://www.linuxsysadmins.com/extend-a ... -in-linux/

I thought it was more easy, after I inserted a new disk, to extend my LVM partitions to the new hard disk, I thought to find something like "extend virtual volume from sdY to sdX for 100gb"...

GabrieleMax
GabrieleMax
 
Posts: 92
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby p.H » 2020-06-18 20:53

GabrieleMax wrote:I'm new in LVM

My remark was not specific to LVM. It is always better to use partitions instead of whole disks for anything : LVM PV, encrypted volume, RAID member, filesystem...

GabrieleMax wrote:2) Create new partitions, why should I create primary, extended and logical partitions?

None. Be modern. Create a GPT partition table and just partitions. No primary/extended/logical with GPT.

GabrieleMax wrote:3) Extend partitions

Huh ? Why would you extend the partitions you just created ? Create them with the right size.

GabrieleMax wrote:I thought it was more easy

It is easy.
- create partition table and partition using fdisk, parted or whatever
- extend VG with partition using vgextend
- extend LVs using lvextend
- extend filesystems in LVs using the filesystem-specific resize tool (resize2fs for ext4)
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby CwF » 2020-06-18 21:58

p.H wrote: It is always better to use partitions instead of whole disks for anything

Why?
CwF
 
Posts: 721
Joined: 2018-06-20 15:16

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby p.H » 2020-06-19 06:25

It avoids the risk of interference with a partition table.
It makes it easier to identify the contents type of the disk.
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby GabrieleMax » 2020-06-20 15:43

p.H wrote:None. Be modern. Create a GPT partition table and just partitions. No primary/extended/logical with GPT.


I did it by cfdisk, GPT, I made a sda1 of 300GB (the entire disk is 500GB)

p.H wrote:It is easy.


For you it's easy! :)

# pvcreate -ff /dev/sda1
Code: Select all
WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: VG Server01-vg is missing PV Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK (last written to [unknown]).
Really INITIALIZE physical volume "/dev/sda1" of volume group "Server01-vg" [y/n]? y
  WARNING: Forcing physical volume creation on /dev/sda1 of volume group "Server01-vg"
  WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: VG Server01-vg is missing PV Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK (last written to [unknown]).
  Physical volume "/dev/sda1" successfully created.


# vgextend Server01-vg /dev/sda1
Code: Select all
WARNING: VG Server01-vg is missing PV Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS (last written to /dev/sda1).
  WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: Couldn't find device with uuid NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS.
  WARNING: VG Server01-vg is missing PV Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS (last written to /dev/sda1).
  WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: Couldn't find device with uuid NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS.
  WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: Couldn't find device with uuid NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS.
  Volume group "Server01-vg" successfully extended


# resize2fs -p /dev/mapper/Server01--vg-home
Code: Select all
resize2fs 1.45.6 (20-Mar-2020)
The filesystem is already 112674816 (4k) blocks long.  Nothing to do!


# pvs
Code: Select all
WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: Couldn't find device with uuid NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS.
  WARNING: VG Server01-vg is missing PV Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS (last written to [unknown]).
  PV         VG          Fmt  Attr PSize    PFree   
  /dev/sda1  Server01-vg lvm2 a--  <300,00g <300,00g
  /dev/sdb5  Server01-vg lvm2 a--  <465,52g       0
  [unknown]  Server01-vg lvm2 a-m  <465,76g <465,76g
  [unknown]  Server01-vg lvm2 a-m  <465,76g <465,76g
  [unknown]  Server01-vg lvm2 a-m  <300,00g <300,00g
GabrieleMax
 
Posts: 92
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby p.H » 2020-06-21 06:37

You did not really do this without removing the PV in that disk with pvremove first, did you ?
When pvcreate/vgextend refused to do what you asked, you did not really force it instead of asking for advice, did you ?
You did not really do this three times, did you ?

Fortunately it seems that you didn't allocate space from any missing PVs, so you can remove them now.
Code: Select all
vgreduce --removemissing Server01-vg


GabrieleMax wrote:resize2fs 1.45.6 (20-Mar-2020)
The filesystem is already 112674816 (4k) blocks long. Nothing to do

As previously written, you must extend the logical volume with lvextend first.
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby GabrieleMax » 2020-06-28 13:37

p.H wrote:Fortunately it seems that you didn't allocate space from any missing PVs, so you can remove them now.
Code: Select all
vgreduce --removemissing Server01-vg



Code: Select all
root@Server01:~# vgreduce --removemissing Server01-vg
  WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: Couldn't find device with uuid NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS.
  WARNING: VG Server01-vg is missing PV Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK (last written to [unknown]).
  WARNING: VG Server01-vg is missing PV NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS (last written to [unknown]).
  WARNING: Couldn't find device with uuid Ese2Vf-W7lJ-jOKZ-Nk24-6Wwk-MM8Y-LZI9ej.
  WARNING: Couldn't find device with uuid Ac22NN-0P6i-c0XE-YMBT-dBnz-1o6O-cZKbJK.
  WARNING: Couldn't find device with uuid NPQW31-UiUX-gUn0-CyvG-AhH6-3ZsO-PDf5aS.
  Wrote out consistent volume group Server01-vg.


And now?
GabrieleMax
 
Posts: 92
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby p.H » 2020-06-28 17:27

First you double check that everything is fine.
Code: Select all
pvs
vgs
lvs

If everything is fine, you can extend logical volumes as needed (as I guess was the initial purpose of adding a disk)

Code: Select all
lvextend -L +XXG /dev/Server01-vg/LV

will add XX GiB to the logical volume LV.

Code: Select all
lvextend -L XXG /dev/Server01-vg/LV

will set the logical volume LV size to XX GiB.

Then you can extend the filesystems inside the extended LVs to the new size. For ext4 :
Code: Select all
resize2fs /dev/Server01-vg/LV

Also, if not already done, you should use your favourite partition editor to change the type of /dev/sda1 to "LVM" so that you know at first glance what the partition is used for.
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby GabrieleMax » 2020-06-28 18:17

First you double check that everything is fine.
Code: Select all
pvs
vgs
lvs

If everything is fine, you can extend logical volumes as needed (as I guess was the initial purpose of adding a disk)

Code: Select all
root@Server01:~# pvs
  PV         VG          Fmt  Attr PSize    PFree   
  /dev/sda1  Server01-vg lvm2 a--  <300,00g <300,00g
  /dev/sdb5  Server01-vg lvm2 a--  <465,52g       0

Code: Select all
root@Server01:~# vgs
  VG          #PV #LV #SN Attr   VSize    VFree   
  Server01-vg   2   5   0 wz--n- <765,52g <300,00g

Code: Select all
root@Server01:~# lvs
  LV     VG          Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home   Server01-vg -wi-ao---- 429,82g                                                   
  root   Server01-vg -wi-ao----  23,28g                                                   
  swap_1 Server01-vg -wi-ao----  <1,25g                                                   
  tmp    Server01-vg -wi-ao----  <1,86g                                                   
  var    Server01-vg -wi-ao----   9,31g     

Code: Select all
lvextend -L +XXG /dev/Server01-vg/LV

will add XX GiB to the logical volume LV.

Code: Select all
root@Server01:~# lvextend -L +299,00g /dev/Server01-vg/home
  Size of logical volume Server01-vg/home changed from 429,82 GiB (110034 extents) to 728,82 GiB (186578 extents).
  Logical volume Server01-vg/home successfully resized.

Also, if not already done, you should use your favourite partition editor to change the type of /dev/sda1 to "LVM" so that you know at first glance what the partition is used for.

I think my work should be done! :wink:
Thanks for your patience and for the time spent to help me! :)
Code: Select all
root@Server01:~# df -h
File system                    Dim. Usati Dispon. Uso% Montato su
udev                           583M     0    583M   0% /dev
tmpfs                          119M  1,5M    118M   2% /run
/dev/mapper/Server01--vg-root   23G  1,5G     21G   7% /
tmpfs                          595M     0    595M   0% /dev/shm
tmpfs                          5,0M     0    5,0M   0% /run/lock
tmpfs                          595M     0    595M   0% /sys/fs/cgroup
/dev/sdb1                      236M   45M    179M  21% /boot
/dev/mapper/Server01--vg-var   9,2G  692M    8,0G   8% /var
/dev/mapper/Server01--vg-home  423G   65G    337G  17% /home
/dev/mapper/Server01--vg-tmp   1,8G  5,7M    1,7G   1% /tmp
tmpfs                          119M     0    119M   0% /run/user/1000


But now if I'd like to extend var I should create sda2?
GabrieleMax
 
Posts: 92
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy

Re: Add new hard drive (LVM) in Bullseye - excluded by a fil

Postby p.H » 2020-06-28 21:29

GabrieleMax wrote:I think my work should be done!

Not yet : you did not resize the filesystem inside the logical volume :
GabrieleMax wrote:
Code: Select all
/dev/mapper/Server01--vg-home  423G   65G    337G  17% /home


GabrieleMax wrote:But now if I'd like to extend var I should create sda2?

Since you allocated all the available space in sda2 to home, you will have to either create a new PV or extend sda2 if you want to extend another LV. By the way, why do you want to extend those LVs which already have plenty of free space ?
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12


Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable