centos7增加系统盘

参考博客:https://blog.csdn.net/liyyzz33/article/details/84333230

https://blog.csdn.net/liyyzz33/article/details/84333230

第一步:使用lvdisplay来获得VG Name。

lvdisplay

第二步:使用fdisk来生产新的一个空间。

fdisk /dev/sda

运行以上命令后,就会出现一连串的问题。下面是我的测试过程中的显示。##是我的注解。

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.
Command (m for help): n ##输入命令n,是建立一个新的空间
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p ##这里选择p,或者直接按回车
Partition number (3,4, default 3): ##程序已经检测到1和2不能使用,所以直接默认为3了。只有是那个数字,这个要用df命令看看有几个sda了。
First sector (20971520-40959999, default 20971520): ##新区的起始扇区。使用默认值。除非有特别的需要。
Using default value 20971520
Last sector, +sectors or +size{K,M,G} (20971520-40959999, default 40959999): ##新区的结束扇区。如果不想把所有剩余空间分配,修改这里。
Using default value 40959999
Partition 3 of type Linux and of size 9.5 GiB is set
Command (m for help): t ##输入t命令。定义新扇区的类型。
Partition number (1-3, default 3): ##默认第三个是新的。回车就行。
Hex code (type L to list all codes): 8e ##直接输入8e就行。8e是Linux LVM类型的代码。
Changed type of partition ‘Linux’ to ‘Linux LVM’
Command (m for help): w ##完成了。输入w命令开始修改。
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.==
 

第三步:重新启动机器。让新的设置生效。

reboot

第四步:创建物理卷

pvcreate /dev/sda3

第五步:使用vgextend把刚刚新建的“/dev/sda3”加入Volume Group里。在第一步,我们已经得到了那个VG名字。这里可以用的上了。

vgextend centos /dev/sda3

第六步:扩展LV(逻辑卷)。

lvextend /dev/centos/root /dev/sda3

第七步:这里要分2部分。
如果你运行的系统是用XFS文件系统的,CENTOS 7的默认文件系统。你就要运行以下命令。

xfs_growfs /dev/centos/root
1
如果你的系统不是使用XFS文件系统,运行以下命令。

resize2fs /dev/centos/root

第八步:使用df来检验一下十分成功。

df -h
发布了42 篇原创文章 · 获赞 6 · 访问量 6138

猜你喜欢

转载自blog.csdn.net/qq_25617289/article/details/103003629
今日推荐