Mount Lvm

Locigal Volume Manager

Mi è capitato di dover montare una partizione LVM dal sistema operativo diverso da quello in cui viene normalmente gestita, questo per resettare una password di root e/o cambiare i permessi di /etc/sudoers che erano troppo restrittivi.

Ho usato questa guida riporto qui la sintesi dei comandi

identificare il volume fisico

# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/hda2  VolGroup01 lvm2 a-   148.94G 32.00M
  /dev/hdb2  VolGroup00 lvm2 a-   114.94G 96.00M

identificare il volume logico

# lvdisplay /dev/VolGroup01
  --- Logical volume ---
  LV Name                /dev/VolGroup01/LogVol00
  VG Name                VolGroup01
  LV UUID                zOQogm-G8I7-a4WC-T7KI-AhWe-Ex3Y-JVzFcR
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                146.97 GB
  Current LE             4703
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/VolGroup01/LogVol01
  VG Name                VolGroup01
  LV UUID                araUBI-4eer-uh5L-Dvnr-3bI6-4gYg-APgYy2
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1.94 GB
  Current LE             62
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:3

montare il volume logico

mount /dev/VolGroup01/LogVol00 /tmp/mnt

resize the file system if the space is not enough

if you find your file system

df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00  6.0G  2.2G  3.9G  37% /

is less than your volume size
sudo vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               99.50 GiB
  PE Size               4.00 MiB
  Total PE              25471
  Alloc PE / Size       1664 / 6.50 GiB
  Free  PE / Size       23807 / 93.00 GiB

you need to resize with this command
lvresize -r -L +10GB /dev/mapper/VolGroup00-LogVol00

in this example we add only 10 GB but depends from the situation
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License