1.查看現有的硬盤分區(如今空間沒有變大) #df -h 2.對新增的硬盤空間作新增分區(硬盤數沒有增長,增長的是空間) #fdisk /dev/sda The number of cylinders for this disk is set to 7832. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): n 說明:新增分區 Command action e extended p primary partition (1-4) p Partition number (1-4): 3 說明:新增分區號(1,2默認已經用了) First cylinder (2611-7832, default 2611): 默認回車(最小) Using default value 2611 Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832):默認回車(最大) Using default value 7832 Command (m for help): t 說明:修改分區類型 Partition number (1-4): 3 說明:修改分區類型對應的分區號 Hex code (type L to list codes): 8e 說明:8e是lvm磁盤類型 Changed system type of partition 3 to 8e (Linux LVM) Command (m for help): p 說明:打印分區表 Disk /dev/sda: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 2610 20860402+ 8e Linux LVM /dev/sda3 2611 7832 41945715 8e Linux LVM Command (m for help): w 說明:保存退出 The partition table has been altered! 3.重啓系統 #reboot 4.查看硬盤狀況(覈對剛纔所作的分區操做是否保存成功) #fdisk -l 5.查看當前分區的類型 #df -T /dev/sda1 說明:查看當前的主分區類型 6.建立文件系統在新的磁盤上 #mkfs.ext4 /dev/sda3 說明:ext4爲你查看到的文件系統類型(ext二、ext三、ext4等) 7.建立PV(pv組成vg,vg組成lv) #pvcreate /dev/sda3 查看pv狀態 #pvdisplay 查看vg狀態 #vgdisplay 8.剛建立的PV加入相應的VG #vgextend vg_centos /dev/sda3 說明:vg_centos是個人服務器vg名稱,請經過查看vg狀態獲得名稱VG name 9.查看LV狀態,把VG加入到LV #lvdisplay 10.lvextend -l +2559 /dev/VolGroup00/LogVol00 說明:2559爲上面pvdisplay查看到的free的PE數量 11.用 resize2fs 調整文件系統大小 resize2fs /dev/mapper/VolGroup00-LogVol00
VolGroup00-LogVol00 看具體狀況