您好,登录后才能下订单哦!
1.挂载物理存储,将新磁盘添加到扩展空间
然后重启机器,进入webbios设置该新增存储的raid(不要动旧的存储的raid,否则会数据丢失)。注意设置完之后启动机器,用fdisk进行新存储的分区。
]# fdisk -l
fdisk /dev/sdb #对第二块硬盘进行操作
Command (m for help): n #新增加一个分区
Command action
e extended
p primary partition (1-4)
p #选择“增加主分区“
Partition number (1-4):1 #选择作为1号分区
First cylinder (1-65270, default 1): #直接回车,新的分区从硬盘的第1扇区开始
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270): #直接回车,新的分区到硬盘的末尾结束,即整块硬盘只分一个区,也是主分区。
Using default value 65270
Command (m for help): t #选择分区类型
Selected partition 1
Hex code (type L to list codes): 83 #选择第83号分区类型(linux类型)
Command (m for help): w #保存到硬盘
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
]# fdisk -l #再次查看硬盘挂载情况,可发现新的硬盘已经ready
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 3917 30944256 8e Linux LVM
/dev/sda3 3917 133674 1042279125 83 Linux
2.新硬盘分区 /dev/sda3 存在,那么就执行 重启
[root@JQ-AQSB-04 ~]# pvscan #查看可分配空间
PV /dev/sda2 VG VolGroup lvm2 [29.51 GiB / 6.51 GiB free]
Total: 1 [29.51 GiB] / in use: 1 [29.51 GiB] / in no VG: 0 [0 ]
## 3.将新加卷加入到指定磁盘中
[root@JQ-AQSB-04 dev]# ls |grep sda3 #看是否在逻辑卷中不在的话进入/dev目录 ls查看是否有 sda3 这个卷
sda3
[root@JQ-AQSB-04 dev]# vgs #查看可扩展空间 发现sda3未显示
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 6 0 wz--n- 29.51g 6.51g
[root@JQ-AQSB-04 dev]# pvscan #查看可扩展空间
PV /dev/sda2 VG VolGroup lvm2 [29.51 GiB / 6.51 GiB free]
Total: 1 [29.51 GiB] / in use: 1 [29.51 GiB] / in no VG: 0 [0 ]
4, 将新分区扩展空间sda3添加
[root@JQ-AQSB-04 dev]# pvcreate /dev/sda3 # 将新分区扩展空间sda3添加
Physical volume "/dev/sda3" successfully created
[root@JQ-AQSB-04 dev]# pvscan # 查看可扩展空间 发现sda3已经显示
PV /dev/sda2 VG VolGroup lvm2 [29.51 GiB / 6.51 GiB free]
PV /dev/sda3 lvm2 [993.99 GiB]
[root@JQ-AQSB-04 dev]# pvcreate /dev/sda3
[root@JQ-AQSB-04 dev]# vgextend VolGroup /dev/sda3 #将新的扩展卷加入
Volume group "VolGroup" successfully extended
vgextend 命令执行前
[root@JQ-AQSB-04 dev]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size 29.51 GiB
PE Size 4.00 MiB
Total PE 7554
Alloc PE / Size 5888 / 23.00 GiB
Free PE / Size 1666 / 6.51 GiB
VG UUID oKMt1Q-GlFT-xZrr-TtgM-zi6a-cxLx-8b29sA
vgextend 命令执行后
[root@JQ-AQSB-04 dev]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 2
Act PV 2
VG Size 1023.50 GiB
PE Size 4.00 MiB
Total PE 262016
Alloc PE / Size 5888 / 23.00 GiB
Free PE / Size 256128 / 1000.50 GiB
VG UUID oKMt1Q-GlFT-xZrr-TtgM-zi6a-cxLx-8b29sA
[root@JQ-AQSB-04 dev]# vgs #可扩展空间
VG #PV #LV #SN Attr VSize VFree
VolGroup 2 6 0 wz--n- 1023.50g 1000.50g
[root@JQ-AQSB-04 dev]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol01 4.0G 449M 3.3G 12% /
tmpfs 48G 0 48G 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/mapper/VolGroup-LogVol04 4.0G 1.9G 1.9G 50% /home
/dev/mapper/VolGroup-LogVol05 4.0G 136M 3.7G 4% /opt
/dev/mapper/VolGroup-LogVol02 4.0G 3.2G 632M 84% /usr
/dev/mapper/VolGroup-LogVol03 4.0G 413M 3.4G 11% /var
[root@JQ-AQSB-04 dev]# lvextend -L +1000G /dev/mapper/VolGroup-LogVol04 #将新加卷添加到指定目录
Extending logical volume LogVol04 to 1004.00 GiB
Logical volume LogVol04 successfully resized
[root@JQ-AQSB-04 dev]# resize2fs /dev/mapper/VolGroup-LogVol04 #格式化新扩展分区
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-LogVol04 is mounted on /home; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 63
Performing an on-line resize of /dev/mapper/VolGroup-LogVol04 to 263192576 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-LogVol04 is now 263192576 blocks long.
[root@JQ-AQSB-04 dev]# timed out waiting for input: auto-logout
[wangguan@JQ-AQSB-04 ~]$ timed out waiting for input: auto-logout
Connection to 10.10.121.26 closed.
添加后展示
[wangguan@JQ-AQSB-04 ~]$ df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol01 4.0G 449M 3.3G 12% /
tmpfs 48G 0 48G 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/mapper/VolGroup-LogVol04 989G 1.9G 937G 1% /home
/dev/mapper/VolGroup-LogVol05 4.0G 136M 3.7G 4% /opt
/dev/mapper/VolGroup-LogVol02 4.0G 3.2G 632M 84% /usr
/dev/mapper/VolGroup-LogVol03 4.0G 413M 3.4G 11% /var
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。