Azure VM扩展系统盘

总所周知啊!这Azure创建VM的时候系统盘的大小是没办法修改的,linux只有30G,windows只有127G,对于windows来说可能足够了,对于linux来说也许就不够了!
那如果我们想扩容系统盘怎么办呢?

有两种办法:

1.使用powershell或Azure cli创建(不会,主要是没看)
2.创建好系统以后再扩容
接下来主要讲第二种
创建好VM以后关掉它,点击磁盘,然后点击到OS磁盘

图片.png

然后点击配置就可以修改大小了
图片.png

然后还没完
登陆操作系统

[root@ZZBX-APP01P ~]# fdisk -l

Disk /dev/sdc: 274.9 GB, 274877906944 bytes, 536870912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 68.7 GB, 68719476736 bytes, 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000a8b4c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    62914559    30944256   83  Linux

Disk /dev/sdb: 15.0 GB, 15032385536 bytes, 29360128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x48631821

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             128    29358079    14678976   83  Linux
[root@ZZBX-APP01P ~]# fdisk /dev/sda

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 is deleted

Command (m for help): p

Disk /dev/sda: 68.7 GB, 68719476736 bytes, 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000a8b4c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (1026048-134217727, default 1026048):
Using default value 1026048
Last sector, +sectors or +size{K,M,G} (1026048-134217727, default 134217727):
Using default value 134217727
Partition 2 of type Linux and of size 63.5 GiB is set

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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@ZZBX-APP01P ~]# reboot

重启以后登陆以后df -h还是没有,在执行一下xfs_growfs /dev/sda2就有了
原因:重启以便重读分区表后,再进行拉伸

[root@ZZBX-APP01P ~]# xfs_growfs /dev/sda2
meta-data=/dev/sda2              isize=512    agcount=4, agsize=1934016 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7736064, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=3777, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 7736064 to 16648960
[root@ZZBX-APP01P ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.4G     0  3.4G   0% /dev
tmpfs           3.4G     0  3.4G   0% /dev/shm
tmpfs           3.4G  9.0M  3.4G   1% /run
tmpfs           3.4G     0  3.4G   0% /sys/fs/cgroup
/dev/sda2        64G  1.4G   63G   3% /
/dev/sda1       497M   64M  433M  13% /boot
/dev/sdb1        14G   41M   13G   1% /mnt/resource
tmpfs           696M     0  696M   0% /run/user/1000
[root@ZZBX-APP01P ~]#

你可能感兴趣的:(Azure VM扩展系统盘)