VMware虚拟机扩容磁盘,但是磁盘空间根分区,还是原来的大小。
root@k8s-master1:~# fdisk -l /dev/sda GPT PMBR size mismatch (41943039 != 83886079) will be corrected by write. Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 sectors Disk model: VMware Virtual S Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 1C8CF497-317C-4DF3-9794-FD754773CF58 Device Start End Sectors Size Type /dev/sda1 2048 4095 2048 1M BIOS boot /dev/sda2 4096 2101247 2097152 1G Linux filesystem /dev/sda3 2101248 41940991 39839744 19G Linux filesystem root@k8s-master1:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 55M 1 loop /snap/core18/1880 loop1 7:1 0 71.3M 1 loop /snap/lxd/16099 loop2 7:2 0 29.9M 1 loop /snap/snapd/8542 sda 8:0 0 40G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 19G 0 part / sdb 8:16 0 40G 0 disk /data root@k8s-master1:~# df -Th Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 1.9G 0 1.9G 0% /dev tmpfs tmpfs 391M 1.5M 390M 1% /run /dev/sda3 xfs 19G 6.7G 13G 36% / tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/loop0 squashfs 55M 55M 0 100% /snap/core18/1880 /dev/sdb xfs 40G 318M 40G 1% /data /dev/loop2 squashfs 30M 30M 0 100% /snap/snapd/8542 /dev/loop1 squashfs 72M 72M 0 100% /snap/lxd/16099 /dev/sda2 xfs 1014M 141M 874M 14% /boot tmpfs tmpfs 391M 0 391M 0% /run/user/0 root@k8s-master1:~# parted -l /dev/sda Model: VMware, VMware Virtual S (scsi) Disk /dev/sda: 42.9GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 2097kB 1049kB bios_grub 2 2097kB 1076MB 1074MB xfs 3 1076MB 21.5GB 20.4GB xfs Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 42.9GB Sector size (logical/physical): 512B/512B Partition Table: loop Disk Flags: Number Start End Size File system Flags 1 0.00B 42.9GB 42.9GB xfs root@k8s-master1:~# parted /dev/sda GNU Parted 3.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) help align-check TYPE N check partition N for TYPE(min|opt) alignment help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkpart PART-TYPE [FS-TYPE] START END make a partition name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END resizepart NUMBER END resize partition NUMBER rm NUMBER delete partition NUMBER select DEVICE choose the device to edit disk_set FLAG STATE change the FLAG on selected device disk_toggle [FLAG] toggle the state of FLAG on selected device set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted
root@k8s-master1:~# parted /dev/sda GNU Parted 3.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) list align-check TYPE N check partition N for TYPE(min|opt) alignment help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkpart PART-TYPE [FS-TYPE] START END make a partition name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END resizepart NUMBER END resize partition NUMBER rm NUMBER delete partition NUMBER select DEVICE choose the device to edit disk_set FLAG STATE change the FLAG on selected device disk_toggle [FLAG] toggle the state of FLAG on selected device set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted (parted) resizepart 3 Warning: Partition /dev/sda3 is being used. Are you sure you want to continue? Yes/No? y End? [21.5GB]? 42.9GB
root@k8s-master1:~# xfs_growfs / root@k8s-master1:~# df -Th Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 1.9G 0 1.9G 0% /dev tmpfs tmpfs 391M 1.5M 390M 1% /run /dev/sda3 xfs 39G 6.9G 33G 18% / tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sdb xfs 40G 318M 40G 1% /data /dev/loop0 squashfs 72M 72M 0 100% /snap/lxd/16099 /dev/loop1 squashfs 55M 55M 0 100% /snap/core18/1880 /dev/loop2 squashfs 30M 30M 0 100% /snap/snapd/8542 /dev/sda2 xfs 1014M 141M 874M 14% /boot tmpfs tmpfs 391M 0 391M 0% /run/user/0