亚马逊EC2根硬盘空间扩容
买的系统盘为32G,结果发现只使用了8G,剩下的都未分配
lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 32G 0 disk └─xvda1 202:1 0 8G 0 part / fdisk -u /dev/xvda Command (m for help): p Disk /dev/xvda: 34.4 GB, 34359738368 bytes, 67108864 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 label type: dos Disk identifier: 0x000998ac Device Boot Start End Blocks Id System /dev/xvda1 * 2048 16777215 8387584 83 Linux Command (m for help): d Selected partition 1 Partition 1 is deleted Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-67108863, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863): Using default value 67108863 Partition 1 of type Linux and of size 32 GiB is set Command (m for help): p Disk /dev/xvda: 34.4 GB, 34359738368 bytes, 67108864 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 label type: dos Disk identifier: 0x000998ac Device Boot Start End Blocks Id System /dev/xvda1 2048 67108863 33553408 83 Linux Command (m for help): w The partition table has been altered! reboot lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 32G 0 disk └─xvda1 202:1 0 32G 0 part / df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 8.0G 1.3G 6.8G 16% / ext格式调整大小 resize2fs /dev/xvda1 xfs格式调整大小 xfs_growfs /dev/xvda1 df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 32G 1.3G 31G 4% /
到此扩容完毕