liunx disk expansion

1. Front expansion

[root@car-template ~]# fdisk  -l

2. increase disk capacity server

[root@car-template ~]# partprobe 
[root@car-template ~]# fdisk -l

3. Expansion

[root@car-template ~]# fdisk  /dev/sda

[root@car-template ~]# ll /dev/sda*
[root@car-template ~]# partprobe 
[root@car-template ~]# ll /dev/sda*

[root@car-template ~]# vgdisplay 

 
 

[root@car-template ~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended

[root@car-template ~]# lvextend -L +19.99G /dev/mapper/centos-root

Rounding size to boundary between physical extents: 19.99 GiB.
Size of logical volume centos/root changed from <35.12 GiB (8990 extents) to <55.11 GiB (14108 extents).
Logical volume centos/root successfully resized.

[root@car-template ~]# xfs_growfs /dev/mapper/centos-root
meta-data = / dev / mapper / Centos-root supply = 512 agcount = 4, agsize = 2301440 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=9205760, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=4495, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 9205760 to 14446592

[root@car-template ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  8.8M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   56G  2.4G   53G   5% /
/dev/sda1               1014M  192M  823M  19% /boot
tmpfs                    379M     0  379M   0% /run/user/0

 

  

  

 

 

 

 

1.扩容前[root@car-template ~]# fdisk  -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x0004cb19
   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048     2099199     1048576   83  Linux/dev/sda2         2099200    83886079    40893440   8e  Linux LVM
Disk /dev/mapper/centos-root: 37.7 GB, 37706792960 bytes, 73646080 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 4160 MB, 4160749568 bytes, 8126464 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes
[root@car-template ~]# df -hFilesystem               Size  Used Avail Use% Mounted ondevtmpfs                 1.9G     0  1.9G   0% /devtmpfs                    1.9G     0  1.9G   0% /dev/shmtmpfs                    1.9G  8.8M  1.9G   1% /runtmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup/dev/mapper/centos-root   36G  2.4G   33G   7% //dev/sda1               1014M  192M  823M  19% /boottmpfs                    379M     0  379M   0% /run/user/0[root@car-template ~]# 

Guess you like

Origin www.cnblogs.com/caonw/p/11927995.html