Centos lvm root extend

Merhaba,

Sunucumda 100GB yeni bir disk ekliyorum,

Disk eklendikten sonra fdisk -l ile diskleri listeliyorum;

[root@newdb ~]# fdisk -l

Disk /dev/sdc: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xb8dfdc1c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   209715199   104856576   8e  Linux LVM

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc1ca3b93

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   209715199   104856576   8e  Linux LVM

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ba9a8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   209715199   103808000   8e  Linux LVM

Disk /dev/mapper/centos-root: 375.8 GB, 375797055488 bytes, 733978624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-home: 41.9 GB, 41871736832 bytes, 81780736 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x15546a54

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048   209715199   104856576   8e  Linux LVM

Disk /dev/sde: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Tek partitionu olmayan ve disk boyutum ile uyuşmayan yeni diski gözlemleyebiliyorum. Mevcut lvm’e extend edebilmem için diskte partition oluşturuyor, disk tipini Linux Lvm olarak değiştiriyorum.

[root@newdb ~]# fdisk /dev/sde
Welcome to fdisk (util-linux 2.23.2).
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
Building a new DOS disklabel with disk identifier 0x69b7c48b.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set
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.

Şimdi mevcut lvm’e dahil edebilriz; lvm detaylarını listelemek için;
lvs veya lvdisplay
vgs veya vgdisplay
pvs veya pvdisplay komutlarını kullanabilirsiniz.

[root@newdb ~]# pvcreate /dev/sde1
Physical volume "/dev/sde1" successfully created.
[root@newdb ~]# vgextend centos /dev/sde1
Volume group "centos" successfully extended
[root@newdb ~]# lvextend -l +100%FREE /dev/mapper/centos-root
Size of logical volume centos/root changed from <349,99 GiB (89597 extents) to 449,98 GiB (115196 extents).
Logical volume centos/root successfully resized.

Dosya formatını öğrenmek için df -Th kullanabilirsiniz,

[root@newdb ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 24G 0 24G 0% /dev
tmpfs tmpfs 24G 0 24G 0% /dev/shm
tmpfs tmpfs 24G 169M 24G 1% /run
tmpfs tmpfs 24G 0 24G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 350G 312G 39G 89% /
/dev/sda1 xfs 1014M 194M 821M 20% /boot
/dev/mapper/centos-home xfs 39G 33M 39G 1% /home
tmpfs tmpfs 4,8G 0 4,8G 0% /run/user/0

Son olarak extend ettiğimiz alanı resize edeceğiz,

[root@newdb ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=28, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=91747328, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 91747328 to 117960704
[root@newdb ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G 0 24G 0% /dev
tmpfs 24G 0 24G 0% /dev/shm
tmpfs 24G 169M 24G 1% /run
tmpfs 24G 0 24G 0% /sys/fs/cgroup
/dev/mapper/centos-root 450G 312G 139G 70% /
/dev/sda1 1014M 194M 821M 20% /boot
/dev/mapper/centos-home 39G 33M 39G 1% /home
tmpfs 4,8G 0 4,8G 0% /run/user/0

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Bu site, istenmeyenleri azaltmak için Akismet kullanıyor. Yorum verilerinizin nasıl işlendiği hakkında daha fazla bilgi edinin.