问题和需求概况:
机器新增两块硬盘,想合在一起,做成一个硬盘。
使用fdisk -l
命令查看机器增加了2块物理磁盘,分别为3T和4T
需要将这两块盘的空间合并在一起,而且还需要动态扩展即在不关机的情况下操作。
解决方案:
采用lvm的方式,合并磁盘,并将两个磁盘的容量合在一起后挂到www分区。
具体操作方法:
1、使用pvcreate将两块新增的物理磁盘加入物理卷
[root@localhost ~]# pvcreate /dev/sdb
Physical volume “/dev/sdb” successfully created
[root@localhost ~]# pvcreate /dev/sdc
Physical volume “/dev/sdc” successfully created
[root@localhost ~]#
2、创建逻辑卷组VolGroup00,并将/dev/sdc加入其中
[root@localhost ~]# vgcreate VolGroup00 /dev/sdb
Volume group “VolGroup00” successfully created
[root@localhost ~]# vgextend VolGroup00 /dev/sdc
Volume group “VolGroup00” successfully extended
3、使用pvdisplay
查看/dev/sdb /dev/sdc的Free PE,一个是102390,另一个是127990,两者之和是230380
pvdisplay
4、使用lvdisplay
查看两块物理磁盘合并后的Free PE SIZE大小通用为230380
lvdisplay
5、然后创建卷:
lvcreate -l +230380 -n vg01 VolGroup00
+230380 部分可以根据自己的磁盘实际数值修改
其中230380
为Free PE SIZE的大小,VolGroup00
为步骤3中创建的卷组名
6、使用lvdisplay
命令获取到LV Path /dev/VolGroup00/vg01
7、并使用mkfs -t ext4 /dev/VolGroup00/vg01命令对其进行格式化
mkfs -t ext4 /dev/VolGroup00/vg01
如果是xfs分区使用下面命令:
mkfs -t xfs /dev/VolGroup00/vg01
8、创建文件夹并挂载,目录大小显示为6.9T,已经将3T和4T两块物理硬盘“合并”在一起了
[root@localhost ~]# mkdir -p /www
[root@localhost ~]# mount /dev/VolGroup00/vg01 /www
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 37G 8.9G 900G 1% /
tmpfs 495M 72K 495M 1% /dev/shm
/dev/sda1 485M 35M 426M 8% /boot
/dev/mapper/VolGroup00-vg01 6.9T 184M 6.9T 0% /www
9、最后,再vi /etc/fstab中写入
vi /etc/fstab
/dev/mapper/VolGroup00-vg01 /www ext4 defaults 0 1
/dev/mapper/VolGroup00-vg01 /www xfs defaults 0 1 /**xfs的文件用这个
10,建议重启一下,如果启动没问题,则大功告成
版权属于: 三三世界-百宝箱
本文链接: http://www.33f.net/linux/centos_lvm_merge_hdd.html
本文最后更新于2022年06月10日 ,已超过830天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
Saved as a favorite, I like your website!
If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.
Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!
Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.
Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊