[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: add disk to LVM



On 2021-06-27 14:03, David wrote:
On Sun, 27 Jun 2021 at 22:10, mick crane <mick.crane@gmail.com> wrote:

root@pumpkin:~# lsblk -f
NAME   FSTYPE      FSVER    LABEL UUID
FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 ext2        1.0            0a3fac2b-e17e-4be0-8cde-c1d2a3edbc2c
   68.6M    66% /boot
├─sda2
└─sda5 LVM2_member LVM2 001 xXXSc7-0LNU-hUfb-yqO1-N0Dy-qcDU-GWuDoP
   ├─pumpkin--vg-root
│ ext4 1.0 92a64093-72bc-4a7b-b239-0d9d1cb20679
   17.6G    31% /
   ├─pumpkin--vg-swap_1
│ swap 1 143694de-2be6-4de8-8731-809a61c0d503
                [SWAP]
   └─pumpkin--vg-home
ext4 1.0 bc21377b-ea12-448c-9dde-0789aee937cd
  149.4G    10% /home
sdb
└─sdb1 ext4        1.0            a8a2440a-0739-48b3-aa85-29715dbf817d
    1.6T     3% /media/mick/a8a2440a-0739-48b3-aa85-29
sr0

root@pumpkin:~# vgs
   VG         #PV #LV #SN Attr   VSize    VFree
   pumpkin-vg   1   3   0 wz--n- <223.33g    0

root@pumpkin:~# pvs
   PV         VG         Fmt  Attr PSize    PFree
   /dev/sda5  pumpkin-vg lvm2 a--  <223.33g    0

root@pumpkin:~# lvs
   LV     VG         Attr       LSize   Pool Origin Data%  Meta%  Move
Log Cpy%Sync Convert
   home   pumpkin-vg -wi-ao---- 179.43g
   root   pumpkin-vg -wi-ao---- <27.94g
   swap_1 pumpkin-vg -wi-ao---- <15.96g

Ok, now the situation is clear.

'lsblk -f' shows that /dev/sdb is not involved in your LVM.
So you can mount its ext4 filesystem wherever you wish.

It looks like some automounter process has mounted it at
/media/mick/a8a2440a-0739-48b3-aa85-29

That number is the UUID that has been written to the device
filesystem to be able to reliably identify it. That filesystem
itself currently has no ext4 label. You can add a label to it
'e2label /dev/sdb1 mylabel'.

If you want to control where it is mounted at boot time,
something like this in your /etc/fstab should achieve that
UUID=a8a2440a-0739-48b3-aa85-29715dbf817d /some/mount/point ext4 noauto

If you prefer instead of UUID=, you could use the e2label command
to give the /dev/sdb1 filesystem a label, and then use syntax
LABEL=mylabel to identify that device in the first argument in
/etc/fstab instead of UUID=...

You can choose /some/mount/point just be sure that it already exists.

'vgs' confirms that there is only one physical volume in your
volume group by "#PV=1".

'pvs' confirms that the only physical volume in your volume group
is /dev/sda5.

This also confirms that the device named /dev/sdb above is not part of
your current LVM configuration. So there's no need to worry about LVM
issues when moving that device around to another machine.

Note that the kernel just happened to refer to this device as 'sdb'
on this boot. Old kernels used to be consistent about this, but the
modern way is that it is not guaranteed to be consistent.
On the next boot it might be named sda or something else. So for that
reason, it's very unwise to specify devices in /etc/fstab using
the '/dev/sdb' notation. That's why I suggest using the UUID or LABEL
syntax in the /etc/fstab example line I gave above.

got it about the labels/UUIDs I think but I think I'm confusing myself here.
The file system doesn't know anything about the LVM ?
The LVM takes care about how and where data is stored on disk.
What is lv root the file system thinks is /
The file system thinks /home is part of / but the LVM puts anything in /home to its "lv home" ?
mick


--
Key ID    4BFEBB31


Reply to: