擴展Linux虛擬機硬盤、分區
添加時間:2011-1-15
添加:
admin
1)關掉Linux虛擬機,運行vmkfstools命令擴展vmdk文件。原大小為50G,現在擴展為65G。vmkfstools -X 65G CentOS53.vmdk
2)開啟Linux虛擬機,可以通過以下命令可以查看新增的可用空間。[root@CentOS53 ~]# parted
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free Model: VMware Virtual disk (scsi)
Disk /dev/sda: 69.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
2 107MB 4401MB 4294MB primary ext3
3 4401MB 6547MB 2147MB primary linux-swap
4 6547MB 53.7GB 47.1GB extended
5 6547MB 8694MB 2147MB logical ext3
6 8694MB 10.8GB 2147MB logical ext3
7 10.8GB 11.9GB 1077MB logical ext3
8 11.9GB 13.0GB 1077MB logical ext3
9 13.0GB 53.7GB 40.7GB logical ext3
53.7GB 69.8GB 16.1GB Free Space
3)運行disk /dev/sda后輸入P查看分區結果如下,并記錄下來(/dev/sda9加載在/data分區上)。可見總共有8485個cylinder,但最后一個分區只是到6527就結束了。這說明后面還有硬盤空間。Disk /dev/sda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 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 535 4192965 83 Linux
/dev/sda3 536 796 2096482 82 Linux swap / Solaris
/dev/sda4 797 6527 46034257 5 Extended
/dev/sda5 797 1057 2096451 83 Linux
/dev/sda6 1058 1318 2096451 83 Linux
/dev/sda7 1319 1449 1052226 83 Linux
/dev/sda8 1450 1580 1052226 83 Linux
/dev/sda9 1581 6527 39736746 83 Linux
4)輸入d刪除擴展分區/dev/sda4,這樣所有的邏輯分區就從分區表中消失了(不要害怕,呵呵)。
5)輸入n創建新的擴展分區,并創建原來(/dev/sda9除外)所有的邏輯分區并保持原來的起始、結束cylinder地址不變。/dev/sda9的起始地址不變,結束地址改為8485。新的分區表如下。確認無誤后輸入w已保存生效。Command (m for help): p Disk /dev/sda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 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 535 4192965 83 Linux /dev/sda3 536 796 2096482 82 Linux swap / Solaris
/dev/sda4 797 8485 61761892 5 Extended
/dev/sda5 797 1057 2096451 83 Linux
/dev/sda6 1058 1318 2096451 83 Linux
/dev/sda7 1319 1449 1052226 83 Linux
/dev/sda8 1450 1580 1052226 83 Linux
/dev/sda9 1581 8485 55464381 83 Linux
6)查看改動后的分區大小。到目前為止,/data分區大小仍未改變。[root@CentOS53 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda8 996M 235M 710M 25% /
/dev/sda9 37G 177M 35G 1% /data
/dev/sda7 996M 34M 911M 4% /home
/dev/sda6 2.0G 76M 1.8G 5% /var
/dev/sda2 3.9G 1.4G 2.4G 38% /usr
/dev/sda5 2.0G 36M 1.9G 2% /usr/local
/dev/sda1 99M 17M 78M 18% /boot
tmpfs 506M 0 506M 0% /dev/shm
7)運行resize2fs /dev/sda9已擴展/data分區。(在2.6.X內核里無需先umount)[root@CentOS53 ~]# resize2fs /dev/sda9
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sda9 is mounted on /apps; on-line resizing required
Performi
2)開啟Linux虛擬機,可以通過以下命令可以查看新增的可用空間。[root@CentOS53 ~]# parted
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free Model: VMware Virtual disk (scsi)
Disk /dev/sda: 69.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
2 107MB 4401MB 4294MB primary ext3
3 4401MB 6547MB 2147MB primary linux-swap
4 6547MB 53.7GB 47.1GB extended
5 6547MB 8694MB 2147MB logical ext3
6 8694MB 10.8GB 2147MB logical ext3
7 10.8GB 11.9GB 1077MB logical ext3
8 11.9GB 13.0GB 1077MB logical ext3
9 13.0GB 53.7GB 40.7GB logical ext3
53.7GB 69.8GB 16.1GB Free Space
3)運行disk /dev/sda后輸入P查看分區結果如下,并記錄下來(/dev/sda9加載在/data分區上)。可見總共有8485個cylinder,但最后一個分區只是到6527就結束了。這說明后面還有硬盤空間。Disk /dev/sda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 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 535 4192965 83 Linux
/dev/sda3 536 796 2096482 82 Linux swap / Solaris
/dev/sda4 797 6527 46034257 5 Extended
/dev/sda5 797 1057 2096451 83 Linux
/dev/sda6 1058 1318 2096451 83 Linux
/dev/sda7 1319 1449 1052226 83 Linux
/dev/sda8 1450 1580 1052226 83 Linux
/dev/sda9 1581 6527 39736746 83 Linux
4)輸入d刪除擴展分區/dev/sda4,這樣所有的邏輯分區就從分區表中消失了(不要害怕,呵呵)。
5)輸入n創建新的擴展分區,并創建原來(/dev/sda9除外)所有的邏輯分區并保持原來的起始、結束cylinder地址不變。/dev/sda9的起始地址不變,結束地址改為8485。新的分區表如下。確認無誤后輸入w已保存生效。Command (m for help): p Disk /dev/sda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 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 535 4192965 83 Linux /dev/sda3 536 796 2096482 82 Linux swap / Solaris
/dev/sda4 797 8485 61761892 5 Extended
/dev/sda5 797 1057 2096451 83 Linux
/dev/sda6 1058 1318 2096451 83 Linux
/dev/sda7 1319 1449 1052226 83 Linux
/dev/sda8 1450 1580 1052226 83 Linux
/dev/sda9 1581 8485 55464381 83 Linux
6)查看改動后的分區大小。到目前為止,/data分區大小仍未改變。[root@CentOS53 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda8 996M 235M 710M 25% /
/dev/sda9 37G 177M 35G 1% /data
/dev/sda7 996M 34M 911M 4% /home
/dev/sda6 2.0G 76M 1.8G 5% /var
/dev/sda2 3.9G 1.4G 2.4G 38% /usr
/dev/sda5 2.0G 36M 1.9G 2% /usr/local
/dev/sda1 99M 17M 78M 18% /boot
tmpfs 506M 0 506M 0% /dev/shm
7)運行resize2fs /dev/sda9已擴展/data分區。(在2.6.X內核里無需先umount)[root@CentOS53 ~]# resize2fs /dev/sda9
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sda9 is mounted on /apps; on-line resizing required
Performi
新文章:
- CentOS7下圖形配置網絡的方法
- CentOS 7如何添加刪除用戶
- 如何解決centos7雙系統后丟失windows啟動項
- CentOS單網卡如何批量添加不同IP段
- CentOS下iconv命令的介紹
- Centos7 SSH密鑰登陸及密碼密鑰雙重驗證詳解
- CentOS 7.1添加刪除用戶的方法
- CentOS查找/掃描局域網打印機IP講解
- CentOS7使用hostapd實現無AP模式的詳解
- su命令不能切換root的解決方法
- 解決VMware下CentOS7網絡重啟出錯
- 解決Centos7雙系統后丟失windows啟動項
- CentOS下如何避免文件覆蓋
- CentOS7和CentOS6系統有什么不同呢
- Centos 6.6默認iptable規則詳解