linux 磁盘管理与操作

添加磁盘后给分区扩容

#格式化

mkfs.ext4 /dev/sdb pvcreate /dev/sdb #查看卷组名#vgdisplay

vgextend vg_name /dev/sdb

lvextend -L +200M /dev/mapper/vg1 /dev/sdb #lvextend -l +%100FREE /dev/mapper/vg1 /dev/sdb resize2fs /dev/mapper/vgh

删除某个lv给其他分区扩

#查看卷组名df -h

umount /dev/mapper/删除的卷组

#修改fstab

vim /etc/fstab

lvremove /dev/mapper/删除的卷组

lvextend -l +100%FREE /dev/mapper/扩容的卷组resize2fs /dev/mapper/扩容的卷组

#如果不能umount

fuser -m /home/d5000/hg/var ps -aux | grep pid

kill -9 pid

fuser -mkvi /home/d5000/hg/var

缩减某个分区给其他扩容

e2fsck -f /dev/mapper/VolGroup-LogVol02 resize2fs -p /dev/mapper/VolGroup-LogVol02 2G lvreduce -L 2G /dev/mapper/VolGroup-LogVol02 vgdisplay

lvextend -l +100%FREE /dev/mapper/VolGroup-LogVol00 e2fsck -f /dev/mapper/VolGroup-LogVol00

resize2fs /dev/mapper/VolGroup-LogVol00 mount -a

df -h

你可能感兴趣的:(linux,磁盘管理与操作)