- 要調整分割槽大小,請輸入fdisk命令,然後使用PV Name(來自第1部分,第2步),末尾不顯示數字。
# fdisk
此示例顯示fdisk /dev/sda命令的輸出:
[root@sessionmgr02 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 9137.
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):
- 在命令提示符下,輸入p並按Enter可檢視分割槽表。
Command (m for help): p
此範例顯示輸入字母「p」後顯示分割槽表的輸出:
Command (m for help): p
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 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 9137 73288530 8e Linux LVM
Command (m for help):
- 記錄要調整大小的分割槽的開始和ID值。例如,在步驟2的示例輸出中,開始: 14 Id: 8e。
開始:_______________________Id:_________________________
- 刪除要調整大小的裝置的分割槽條目。在命令提示符下輸入d。
Command (m for help): d
此範例顯示輸入d後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4):
- 在Partition number提示符下,輸入要刪除的分割槽編號,然後按Enter。(裝置名稱末尾的編號是分割槽編號。)
Partition number (1-4): <number>
此示例顯示輸入分割槽編號後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help):
- 在命令提示符下,輸入n以建立新分割槽。
Command (m for help): n
此範例顯示輸入n後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Command (m for help): n
- 為主分割槽輸入p。
Command (m for help): p
此範例顯示輸入p後的輸出:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
- 在Partition number提示符下,輸入分割槽編號,然後按Enter(與已刪除的分割槽編號相同)。 在本例中,數字為2。
Partition number (1-4): 2
此示例顯示輸入分割槽編號後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9137, default 14):
- 確認第一個圓柱體編號的預設值與本節步驟3中的起始值匹配。如果是,請按Enter鍵接受預設值。 如果不匹配,請確保它與任何現有分割槽不重疊,然後手動輸入值,然後按Enter。
此範例顯示接受預設值並按Enter鍵後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
- 對於「最後圓柱面」值,請按Enter以使用預設值。
此示例顯示接受預設值並按Enter鍵後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help):
- 在命令提示符下,輸入t並按Enter。
Command (m for help): t
此範例顯示輸入t後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4):
- 在分割槽編號提示符下,輸入要調整大小的分割槽編號,然後按Enter。
Partition number (1-4): 2
此示例顯示輸入分割槽編號後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes):
- 在十六進位制代碼提示符下,鍵入十六進位制代碼。這是本節中步驟3的Id值。按Enter鍵。
Hex code (type L to list codes): 8e
此示例顯示輸入十六進位制代碼後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help):
- 在命令提示符下,輸入w將分割槽寫入磁碟。
Command (m for help): w
此範例顯示您在提示中輸入w後的結果:
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 5221 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 9137 73288530 8e Linux LVM
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-9790, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-9790, default 9790):
Using default value 9790
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@sessionmgr02 ~]#
這會退出fdisk並進入根提示。
- 重新啟動VM以確保新設定與核心匹配。
# init 6
- 在VM完成重新啟動(約5分鐘)後,以根使用者身份登入(ssh)VM。
- 使用fdisk -l <PV Name>命令檢視新的分割槽大小(PV Name來自第1部分第2步),以確保現在磁碟大小更大。
[root@sessionmgr02 ~]# fdisk -l /dev/sda
Disk /dev/sda2: 80.4 GB, 80418562560 bytes
255 heads, 63 sectors/track, 9777 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
此示例輸出顯示/dev/sda現在已為其分配了80GB。