I am running ubuntu server 18 in hyper-v, I need to extend HDD. When i use fdisk -l I see that /dev/sda2/ have 1TB:
Disk /dev/sda: 1 TiB, 1105954078720 bytes, 2160066560 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
Disklabel type: gpt
Disk identifier: 8F74C1DF-DF9B-4FD7-AD20-87F1D8A8F989
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2160066526 2160062431 1T Linux filesystem
when i use df -h i see that /dev/sda2 have only 125G:
Filesystem Size Used Avail Use% Mounted on
udev 419M 0 419M 0% /dev
tmpfs 90M 972K 89M 2% /run
/dev/sda2 125G 11G 108G 9% /
tmpfs 449M 0 449M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 449M 0 449M 0% /sys/fs/cgroup
/dev/loop0 91M 91M 0 100% /snap/core/6350
/dev/loop1 89M 89M 0 100% /snap/core/6964
/dev/loop2 98M 98M 0 100% /snap/docker/384
/dev/loop3 98M 98M 0 100% /snap/docker/372
/dev/loop4 98M 98M 0 100% /snap/docker/381
/dev/loop5 90M 90M 0 100% /snap/core/6818
tmpfs 90M 0 90M 0% /run/user/1000
What should I do, when I want to use full disk capacity? Thank you.
Answer
It seems to me like the actual partition us larger then what the filesystem thinks. This is unusual but can happen when you bitcopy the contents if a block device to a larger one.
Before doing disk operations its a good idea to back up your data as there is small chance things will go seriously wrong. Once you have backed up simply issue a command to grow the filesystem. This can usually be done online (but you can't shrink online). Assuming its on ext filesystem the command is something like resize2fs /dev/sda2 or resize4fs /dev/sda2.dependong on distro. If its not an ext filesystem there is likely an equivalent command.
Comments
Post a Comment