Работа с дисками parted
Before allocation:
server:/$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.5G 0 1.5G 0% /dev tmpfs 301M 1.1M 300M 1% /run /dev/sda2 16G 13G 2.4G 84% / tmpfs 1.5G 0 1.5G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup /dev/loop0 91M 91M 0 100% /snap/core/6350 tmpfs 301M 0 301M 0% /run/user/1000
Now extend the partition:
server:/$ sudo parted [sudo] password for username: GNU Parted 3.2 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: VMware Virtual disk (scsi) Disk /dev/sda: 32.2GB 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 17.2GB 17.2GB ext4 (parted) resizepart 2 Warning: Partition /dev/sda2 is being used. Are you sure you want to continue? Yes/No? Yes End? [17.2GB]? 32.2GB (parted) q Information: You may need to update /etc/fstab.
5. Thereafter, grow the filesystem using the resize2fs:
server:/$ sudo resize2fs /dev/sda2 resize2fs 1.44.1 (24-Mar-2018) Filesystem at /dev/sda2 is mounted on /; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 4 The filesystem on /dev/sda2 is now 7860816 (4k) blocks long.
Finally, the disk capacity has increased:
server:/$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.5G 0 1.5G 0% /dev tmpfs 301M 1.1M 300M 1% /run /dev/sda2 30G 15G 14G 53% / tmpfs 1.5G 0 1.5G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup /dev/loop0 91M 91M 0 100% /snap/core/6350 tmpfs 301M 0 301M 0% /run/user/1000