Agregar espacio a LVM Linux Incared

Card image cap
Escrito por Soporte Incared

Using username "root".
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Mon Apr 22 09:57:37 2024
[root@rhel-incared ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               7.7G     0  7.7G   0% /dev
tmpfs                  7.7G     0  7.7G   0% /dev/shm
tmpfs                  7.7G  8.6M  7.7G   1% /run
tmpfs                  7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/rhel-root   70G   67G  3.1G  96% /
/dev/sda1             1014M  323M  692M  32% /boot
/dev/mapper/rhel-home  122G  9.3G  112G   8% /home
tmpfs                  1.6G     0  1.6G   0% /run/user/1001
tmpfs                  1.6G     0  1.6G   0% /run/user/0
[root@rhel-incared ~]# fdisk -l
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: dos
Disk identifier: 0x2158e921

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *       2048   2099199   2097152    1G 83 Linux
/dev/sda2       2099200 419430399 417331200  199G 8e Linux LVM
Disk /dev/mapper/rhel-root: 70 GiB, 75161927680 bytes, 146800640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes

Disk /dev/mapper/rhel-swap: 7.9 GiB, 8443133952 bytes, 16490496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes


Disk /dev/mapper/rhel-home: 121.1 GiB, 130065367040 bytes, 254033920 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes

Disk /dev/sdb: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
[root@rhel-incared ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x239522ce.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-314572799, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-314572799, default 314572799):

Created a new partition 1 of type 'Linux' and of size 150 GiB.

Command (m for help): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      f2  DOS secondary
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto
1c  Hidden W95 FAT3 75  PC/IX           bc  Acronis FAT32 L fe  LANstep
1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT


Command (m for help): t

Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@rhel-incared ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
[root@rhel-incared ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.45.6 (20-Mar-2020)
/dev/sdb1 contains a LVM2_member file system
Proceed anyway? (y,N) Y
Discarding device blocks: done
Creating filesystem with 39321344 4k blocks and 9830400 inodes
Filesystem UUID: f7e5df29-37c6-444e-b097-8e89dd32f7d2
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

[root@rhel-incared ~]# vgdisplay
  --- Volume group ---
  VG Name               rhel
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <199.00 GiB
  PE Size               4.00 MiB
  Total PE              50943
  Alloc PE / Size       50943 / <199.00 GiB
  Free  PE / Size       0 / 0
  VG UUID               Ok9mQe-eGsv-FvDs-WiVr-T3gO-U9rV-PxSAFZ

[root@rhel-incared ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel/swap
  LV Name                swap
  VG Name                rhel
  LV UUID                WcghOH-jOzq-iUsh-TPar-58vN-Rwr4-SsCnKl
  LV Write Access        read/write
  LV Creation host, time jenkins-master.vuce.gob.pe, 2023-09-25 08:46:27 -0500
  LV Status              available
  # open                 2
  LV Size                7.86 GiB
  Current LE             2013
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/rhel/home
  LV Name                home
  VG Name                rhel
  LV UUID                lvVREG-KqxP-0t54-hZ1N-hAsb-9vzP-3DNe96
  LV Write Access        read/write
  LV Creation host, time jenkins-master.vuce.gob.pe, 2023-09-25 08:46:27 -0500
  LV Status              available
  # open                 1
  LV Size                121.13 GiB
  Current LE             31010
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/rhel/root
  LV Name                root
  VG Name                rhel
  LV UUID                OYBe97-WlaT-X0eh-KGki-WTDC-6KfG-NQLWzz
  LV Write Access        read/write
  LV Creation host, time jenkins-master.vuce.gob.pe, 2023-09-25 08:46:28 -0500
  LV Status              available
  # open                 1
  LV Size                70.00 GiB
  Current LE             17920
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

[root@rhel-incared ~]# vgextend rhel /dev/sdb1
WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdb1.
  Physical volume "/dev/sdb1" successfully created.
  Volume group "rhel" successfully extended
[root@rhel-incared ~]# vgdisplay
  --- Volume group ---
  VG Name               rhel
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               348.99 GiB
  PE Size               4.00 MiB
  Total PE              89342
  Alloc PE / Size       50943 / <199.00 GiB
  Free  PE / Size       38399 / <150.00 GiB
  VG UUID               Ok9mQe-eGsv-FvDs-WiVr-T3gO-U9rV-PxSAFZ

[root@rhel-incared ~]# vgdisplay
  --- Volume group ---
  VG Name               rhel
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               348.99 GiB
  PE Size               4.00 MiB
  Total PE              89342
  Alloc PE / Size       50943 / <199.00 GiB
  Free  PE / Size       38399 / <150.00 GiB
  VG UUID               Ok9mQe-eGsv-FvDs-WiVr-T3gO-U9rV-PxSAFZ

[root@rhel-incared ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel/swap
  LV Name                swap
  VG Name                rhel
  LV UUID                WcghOH-jOzq-iUsh-TPar-58vN-Rwr4-SsCnKl
  LV Write Access        read/write
  LV Creation host, time jenkins-master.vuce.gob.pe, 2023-09-25 08:46:27 -0500
  LV Status              available
  # open                 2
  LV Size                7.86 GiB
  Current LE             2013
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/rhel/home
  LV Name                home
  VG Name                rhel
  LV UUID                lvVREG-KqxP-0t54-hZ1N-hAsb-9vzP-3DNe96
  LV Write Access        read/write
  LV Creation host, time jenkins-master.vuce.gob.pe, 2023-09-25 08:46:27 -0500
  LV Status              available
  # open                 1
  LV Size                121.13 GiB
  Current LE             31010
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/rhel/root
  LV Name                root
  VG Name                rhel
  LV UUID                OYBe97-WlaT-X0eh-KGki-WTDC-6KfG-NQLWzz
  LV Write Access        read/write
  LV Creation host, time jenkins-master.vuce.gob.pe, 2023-09-25 08:46:28 -0500
  LV Status              available
  # open                 1
  LV Size                70.00 GiB
  Current LE             17920
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

[root@rhel-incared ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               7.7G     0  7.7G   0% /dev
tmpfs                  7.7G     0  7.7G   0% /dev/shm
tmpfs                  7.7G  8.6M  7.7G   1% /run
tmpfs                  7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/rhel-root   70G   67G  3.1G  96% /
/dev/sda1             1014M  323M  692M  32% /boot
/dev/mapper/rhel-home  122G  9.3G  112G   8% /home
tmpfs                  1.6G     0  1.6G   0% /run/user/1001
tmpfs                  1.6G     0  1.6G   0% /run/user/0


[root@rhel-incared ~]# lvextend -l+100%free /dev/rhel/root
  Size of logical volume rhel/root changed from 70.00 GiB (17920 extents) to <220.00 GiB (56319 extents).
  Logical volume rhel/root successfully resized.

[root@rhel-incared ~]# xfs_growfs /dev/rhel/root
meta-data=/dev/mapper/rhel-root  isize=512    agcount=4, agsize=4587520 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=18350080, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=8960, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 18350080 to 57670656
[root@rhel-incared ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               7.7G     0  7.7G   0% /dev
tmpfs                  7.7G     0  7.7G   0% /dev/shm
tmpfs                  7.7G  8.6M  7.7G   1% /run
tmpfs                  7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/rhel-root  220G   68G  152G  31% /
/dev/sda1             1014M  323M  692M  32% /boot
/dev/mapper/rhel-home  122G  9.3G  112G   8% /home
tmpfs                  1.6G     0  1.6G   0% /run/user/1001
tmpfs                  1.6G     0  1.6G   0% /run/user/0
[root@rhel-incared ~]#

Tu carrito está vacío.

Volver a la tienda