User Tools

Site Tools


informatica:linux:discos:lvm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatica:linux:discos:lvm [2020/12/23 13:35] javiinformatica:linux:discos:lvm [2023/10/05 00:27] (current) jose
Line 605: Line 605:
   THIS MAY DESTROY YOUR DATA (filesystem etc.)   THIS MAY DESTROY YOUR DATA (filesystem etc.)
 Do you really want to reduce vg/swap? [y/n] Do you really want to reduce vg/swap? [y/n]
-<code>+</code>
  
 Pulsar 'y' y 'enter' Pulsar 'y' y 'enter'
Line 650: Line 650:
 </code> </code>
  
 +
 +====== Debian 12 ======
 +Tenemos que desmontar /home
 +
 +Miramos las particiones:
 +<code>
 +root@debian:~# df -h
 +Filesystem                   Size  Used Avail Use% Mounted on
 +udev                         3.8G      3.8G   0% /dev
 +tmpfs                        783M  688K  783M   1% /run
 +/dev/mapper/debian--vg-root   22G  1.5G   20G   7% /
 +tmpfs                        3.9G      3.9G   0% /dev/shm
 +tmpfs                        5.0M      5.0M   0% /run/lock
 +/dev/mapper/debian--vg-var   7.6G  262M  6.9G   4% /var
 +/dev/mapper/debian--vg-home   85G   40K   81G   1% /home
 +/dev/mapper/debian--vg-tmp   1.4G   40K  1.3G   1% /tmp
 +/dev/sda1                    455M   99M  332M  23% /boot
 +tmpfs                        783M      783M   0% /run/user/0
 +tmpfs                        783M      783M   0% /run/user/1000
 +</code>
 +
 +Miramos LVM
 +<code>
 +root@debian:~# lvdisplay 
 +  --- Logical volume ---
 +  LV Path                /dev/debian-vg/root
 +  LV Name                root
 +  VG Name                debian-vg
 +  LV UUID                sM1VB5-QkRX-BXM1-No2F-S23M-YwQU-Cg5351
 +  LV Write Access        read/write
 +  LV Creation host, time debian, 2023-10-04 18:21:09 -0400
 +  LV Status              available
 +  # open                 1
 +  LV Size                22.25 GiB
 +  Current LE             5697
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     256
 +  Block device           254:0
 +   
 +  --- Logical volume ---
 +  LV Path                /dev/debian-vg/var
 +  LV Name                var
 +  VG Name                debian-vg
 +  LV UUID                u5Hxq6-k9eJ-25WS-AK02-afVC-o76u-vlYnyd
 +  LV Write Access        read/write
 +  LV Creation host, time debian, 2023-10-04 18:21:09 -0400
 +  LV Status              available
 +  # open                 1
 +  LV Size                <7.73 GiB
 +  Current LE             1978
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     256
 +  Block device           254:1
 +   
 +  --- Logical volume ---
 +  LV Path                /dev/debian-vg/swap_1
 +  LV Name                swap_1
 +  VG Name                debian-vg
 +  LV UUID                r88cII-vYx4-aAmF-85yJ-vjq6-8jkR-vS5JtK
 +  LV Write Access        read/write
 +  LV Creation host, time debian, 2023-10-04 18:21:09 -0400
 +  LV Status              available
 +  # open                 2
 +  LV Size                976.00 MiB
 +  Current LE             244
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     256
 +  Block device           254:2
 +   
 +  --- Logical volume ---
 +  LV Path                /dev/debian-vg/tmp
 +  LV Name                tmp
 +  VG Name                debian-vg
 +  LV UUID                mZHGHj-VUxN-QQhR-q8Lb-DAvW-E9sn-8ZuZ15
 +  LV Write Access        read/write
 +  LV Creation host, time debian, 2023-10-04 18:21:09 -0400
 +  LV Status              available
 +  # open                 1
 +  LV Size                1.37 GiB
 +  Current LE             351
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     256
 +  Block device           254:3
 +   
 +  --- Logical volume ---
 +  LV Path                /dev/debian-vg/home
 +  LV Name                home
 +  VG Name                debian-vg
 +  LV UUID                69Y7rL-hzIr-21jn-KV3R-8qP5-XLdg-arYSL7
 +  LV Write Access        read/write
 +  LV Creation host, time debian, 2023-10-04 18:21:10 -0400
 +  LV Status              available
 +  # open                 1
 +  LV Size                <86.43 GiB
 +  Current LE             22126
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     256
 +  Block device           254:4
 +</code>
 +Quitamos 40Gbs a /home:
 +  lvreduce -L -40G /dev/debian-vg/home
 +<code>
 +  WARNING: Reducing active and open logical volume to <46.43 GiB.
 +  THIS MAY DESTROY YOUR DATA (filesystem etc.)
 +Do you really want to reduce debian-vg/home? [y/n]: y
 +  Size of logical volume debian-vg/home changed from <86.43 GiB (22126 extents) to <46.43 GiB (11886 extents).
 +  Logical volume debian-vg/home successfully resized.
 +</code>
 +Vemos que hay 40Gb libres:
 +<code>
 +root@debian:~# vgdisplay 
 +  --- Volume group ---
 +  VG Name               debian-vg
 +  System ID             
 +  Format                lvm2
 +  Metadata Areas        1
 +  Metadata Sequence No  7
 +  VG Access             read/write
 +  VG Status             resizable
 +  MAX LV                0
 +  Cur LV                5
 +  Open LV               5
 +  Max PV                0
 +  Cur PV                1
 +  Act PV                1
 +  VG Size               118.76 GiB
 +  PE Size               4.00 MiB
 +  Total PE              30403
 +  Alloc PE / Size       20156 / 78.73 GiB
 +  Free  PE / Size       10247 / <40.03 GiB
 +  VG UUID               RjQDgJ-Nz9a-WDQG-4JoJ-KPHc-CUG4-zed2BI
 +</code>
 +
 +Se las añadimos a /var
 +  lvextend -L +40G /dev/debian-vg/var
 +<code>
 +  Size of logical volume debian-vg/var changed from <7.73 GiB (1978 extents) to <47.73 GiB (12218 extents).
 +  Logical volume debian-vg/var successfully resized.
 +</code>
 +Vemos que todavía no lo ha añadido:
 +<code>
 +df -h
 +Filesystem                   Size  Used Avail Use% Mounted on
 +/dev/mapper/debian--vg-root   22G  1.5G   20G   7% /
 +/dev/mapper/debian--vg-home   85G   40K   81G   1% /home
 +/dev/mapper/debian--vg-tmp   1.4G   40K  1.3G   1% /tmp
 +/dev/mapper/debian--vg-var   7.6G  262M  6.9G   4% /var
 +</code>
 +Pero con lvdisplay si aparece:
 +<code>
 +  --- Logical volume ---
 +  LV Path                /dev/debian-vg/var
 +  LV Name                var
 +  VG Name                debian-vg
 +  LV UUID                jud91P-5LXr-t0KI-5KSM-nim3-Xhvk-oSwkw5
 +  LV Write Access        read/write
 +  LV Creation host, time debian, 2023-10-04 19:47:42 -0400
 +  LV Status              available
 +  # open                 1
 +  LV Size                <47.73 GiB
 +  Current LE             12218
 +  Segments               2
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     256
 +  Block device           254:1
 +</code>
 +Hay que extender el FS:
 +  resize2fs /dev/debian-vg/var
 +
 +  resize2fs 1.47.0 (5-Feb-2023)
 +  Filesystem at /dev/debian-vg/var is mounted on /var; on-line resizing required
 +  old_desc_blocks = 1, new_desc_blocks = 6
 +  The filesystem on /dev/debian-vg/var is now 12511232 (4k) blocks long.
 +Ahora si que aparece:
 +<code>
 +root@debian:~# df -h
 +Filesystem                   Size  Used Avail Use% Mounted on
 +/dev/mapper/debian--vg-root   22G  1.5G   20G   7% /
 +/dev/mapper/debian--vg-home   85G   40K   81G   1% /home
 +/dev/mapper/debian--vg-tmp   1.4G   40K  1.3G   1% /tmp
 +/dev/mapper/debian--vg-var    47G  262M   45G   1% /var
 +</code>
informatica/linux/discos/lvm.1608730539.txt.gz · Last modified: 2020/12/23 13:35 by javi