Linux 磁盘扩容

[root@localhost ~]# fdisk -l

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 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

[root@localhost ~]# df -h

Filesystem              Size  Used Avail Use% Mounted on

devtmpfs                5.9G    0  5.9G  0% /dev

tmpfs                    5.9G    0  5.9G  0% /dev/shm

tmpfs                    5.9G  9.0M  5.9G  1% /run

tmpfs                    5.9G    0  5.9G  0% /sys/fs/cgroup

/dev/mapper/centos-root  27G  27G  638M  98% /

/dev/sda1              1014M  272M  743M  27% /boot

tmpfs                    1.2G    0  1.2G  0% /run/user/0

[root@localhost ~]#parted /dev/sdb

GNU Parted 3.1

Using /dev/sdb

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel

New disk label type? msdos

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?

Yes/No? yes                                                             

(parted) quit

[root@localhost ~]# vgdisplay

[root@localhost ~]# vgextend centos /dev/sdb

[root@localhost ~]# lvextend -l +100%FREE /dev/mapper/centos-root

[root@localhost ~]# xfs_growfs /dev/mapper/centos-root

[root@localhost ~]# df -h

Filesystem              Size  Used Avail Use% Mounted on

devtmpfs                5.9G    0  5.9G  0% /dev

tmpfs                    5.9G    0  5.9G  0% /dev/shm

tmpfs                    5.9G  9.0M  5.9G  1% /run

tmpfs                    5.9G    0  5.9G  0% /sys/fs/cgroup

/dev/mapper/centos-root  47G  27G  21G  57% /

/dev/sda1              1014M  272M  743M  27% /boot

tmpfs                    1.2G    0  1.2G  0% /run/user/0

你可能感兴趣的:(Linux 磁盘扩容)