根據你的描述,我在我的實驗室測試,我測試的Red Hat Enterprise Linux Server release 7.3 (Maipo)
。
注意:當你沒有它時,我強烈建議你可以備份你的OS VHD。如果 確實失敗,則無法啓動虛擬機。
1.在Azure Portal上停止虛擬機。
2.使用Azure CLI增加操作系統磁盤。
az vm update -g shui -n shui --set storageProfile.osDisk.diskSizeGB=100
3.啓動您的VM和ssh到您的虛擬機。您可以檢查df -h
和fdisk -l
。 /dev/sda2
不會增加到100GB。您需要按照以下命令進行操作。
sudo -i
[[email protected] ~]# fdisk /dev/sda
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): p
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x0001461e
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 83 Linux
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): p
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x0001461e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 1026048 62914559 30944256 83 Linux
Command (m for help): d
Partition number (1-4): 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-104857599, default 63): 64
Last sector, +sectors or +size{K,M,G} (64-1026047, default 1026047):
Using default value 1026047
Command (m for help): p
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x0001461e
Device Boot Start End Blocks Id System
/dev/sda1 64 1026047 512992 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 1026048 62914559 30944256 83 Linux
Command (m for help): wq
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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
[[email protected] ~]# fdisk -l /dev/sda
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x0001461e
Device Boot Start End Blocks Id System
/dev/sda1 1 64 512992 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 3917 30944256 83 Linux
4.重新啓動你的VM
5.SSH你的VM和調整文件系統。現在
xfs_growfs -d /dev/sda2
,你可以用df -h
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 100G 1.7G 98G 2%/
是的。我測試了它的操作系統盤。其作品。 – karan