linux使用fdisk对硬盘进行lvm分区扩容硬盘并且shell自动化一键脚本方法 tmpfdisk.sh
linux使用fdisk对硬盘进行lvm分区扩容硬盘并且shell自动化一键脚本方法 tmpfdisk.sh扩容参考,根据这个贴写的,有需要自己修改,注意快照,否则可能引起无法启动等问题:http://bbs.itzmx.com/thread-21922-1-1.html
vi tmp.sh
#!/bin/bash
echo "n
p
3
41611
t
3
8e
w
" | fdisk /dev/vda
echo -e "mkfs -t ext4 /dev/vda3\npvcreate /dev/vda3\nvgextend VolGroup /dev/vda3\nlvextend -r -l +100%FREE /dev/mapper/VolGroup-lv_root\nsed -i '/tmpfdisk.sh$/d' /etc/rc.d/rc.local\nrm -rf /root/tmpfdisk.sh" >> /root/tmpfdisk.sh
echo "sh /root/tmpfdisk.sh" >> /etc/rc.d/rc.local && rm -rf tmp.sh && reboot
25G升级到40G硬盘的话
vi tmp.sh
#!/bin/bash
echo "n
p
4
52013
t
4
8e
w
" | fdisk /dev/vda
echo -e "mkfs -t ext4 /dev/vda4\npvcreate /dev/vda4\nvgextend VolGroup /dev/vda4\nlvextend -r -l +100%FREE /dev/mapper/VolGroup-lv_root\nsed -i '/tmpfdisk.sh$/d' /etc/rc.d/rc.local\nrm -rf /root/tmpfdisk.sh" >> /root/tmpfdisk.sh
echo "sh /root/tmpfdisk.sh" >> /etc/rc.d/rc.local && rm -rf tmp.sh && reboot
自己后来直接新开的5刀一个月的款式升级40G
vi tmp.sh
#!/bin/bash
echo "n
p
3
52013
t
3
8e
w
" | fdisk /dev/vda
echo -e "mkfs -t ext4 /dev/vda3\npvcreate /dev/vda3\nvgextend VolGroup /dev/vda3\nlvextend -r -l +100%FREE /dev/mapper/VolGroup-lv_root\nsed -i '/tmpfdisk.sh$/d' /etc/rc.d/rc.local\nrm -rf /root/tmpfdisk.sh" >> /root/tmpfdisk.sh
echo "sh /root/tmpfdisk.sh" >> /etc/rc.d/rc.local && rm -rf tmp.sh && reboot
页:
[1]