Centos 新增硬盘以后,系统不能自动进行识别。
1. 由于不知道新增硬盘挂载的位置,可以先查看现有硬盘挂载的适配器。
[root@localhost ~]# ls -l /sys/block/sda
lrwxrwxrwx. 1 root root 0 Jun 15 11:47 /sys/block/sda -> ../devices/pci0000:00/0000:00:10.0/host32/target32:0:0/32:0:0:0/block/sda
2. 发现正在磁盘挂载到host32,可以尝试使用下边命令,重新扫描host32信息
echo "- - -" > /sys/class/scsi_host/host32/scan
3、fdisk 磁盘
查看分区格式
#需要达到的效果,分区格式为 LVM
[root@localhost ~]# fdisk -l
Disk /dev/sdb: 2147.5 GB, 2147483648000 bytes
255 heads, 63 sectors/track, 261083 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x39a49a90
Device Boot Start End Blocks Id System
/dev/sdb1 1 261083 2097149166 8e Linux LVM
修改分区格式为8e(lvm)
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x10342e9b.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n #####输入n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-97906, default 1): #####回车
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-97906, default 97906): #####回车,或者+size xxG,自己定
Using default value 97906
Command (m for help): t #####输入t
Selected partition 1
Hex code (type L to list codes): 8e #####输入8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p #####查看修改之后
Disk /dev/sdd: 805.3 GB, 805306368000 bytes
255 heads, 63 sectors/track, 97906 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x10342e9b
Device Boot Start End Blocks Id System
/dev/sdd1 1 97906 786429913+ 8e Linux LVM
Command (m for help): w ####保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
————————————————
4、创建pv
pvcreate /dev/sdb
5、将创建好的pv加载至vg内
vgextend VolGroup00 /dev/sdb
6、扩展lvs将所有空间加入
lvextend -l +100%FREE /dev/mapper/VolGroup00-LogVol00
7、在线扩容卷大小,不同的文件系统命令不一样。
适用于ext文件系统
resize2fs /dev/mapper/VolGroup00-LogVol00
适用于xfs文件系统
xfs_growfs /dev/mapper/VolGroup00-LogVol00
文章评论