Created
September 17, 2018 11:19
-
-
Save yegorgavrilov/6944a49ee48a8ccda4b101f4752637cb to your computer and use it in GitHub Desktop.
Resize FS on Linux (extend partition size)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@stg530:~# fdisk -l | |
Disk /dev/sdb: 32 GiB, 34359738368 bytes, 67108864 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: dos | |
Disk identifier: 0x9ccb23b5 | |
Device Boot Start End Sectors Size Id Type | |
/dev/sdb1 128 67106815 67106688 32G 83 Linux | |
Disk /dev/sda: 256 GiB, 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 | |
Disklabel type: dos | |
Disk identifier: 0xf728ee4d | |
Device Boot Start End Sectors Size Id Type | |
/dev/sda1 2048 268435455 268433408 128G 83 Linux | |
root@stg530:~# fdisk -u /dev/sda | |
Welcome to fdisk (util-linux 2.25.2). | |
Changes will remain in memory only, until you decide to write them. | |
Be careful before using the write command. | |
Command (m for help): p | |
Disk /dev/sda: 256 GiB, 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 | |
Disklabel type: dos | |
Disk identifier: 0xf728ee4d | |
Device Boot Start End Sectors Size Id Type | |
/dev/sda1 2048 268435455 268433408 128G 83 Linux | |
Command (m for help): d | |
Selected partition 1 | |
Partition 1 has been deleted. | |
Command (m for help): n | |
Partition type | |
p primary (0 primary, 0 extended, 4 free) | |
e extended (container for logical partitions) | |
Select (default p): p | |
Partition number (1-4, default 1): | |
First sector (2048-536870911, default 2048): | |
Last sector, +sectors or +size{K,M,G,T,P} (2048-536870911, default 536870911): | |
Created a new partition 1 of type 'Linux' and of size 256 GiB. | |
Command (m for help): w | |
The partition table has been altered. | |
Calling ioctl() to re-read partition table. | |
Re-reading the partition table failed.: 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). | |
root@stg530:~# df -h . | |
Filesystem Size Used Avail Use% Mounted on | |
/dev/sda1 126G 101G 20G 84% / | |
root@stg530:~# reboot | |
root@stg530:~# resize2fs /dev/sda1 | |
resize2fs 1.42.12 (29-Aug-2014) | |
Filesystem at /dev/sda1 is mounted on /; on-line resizing required | |
old_desc_blocks = 16, new_desc_blocks = 32 | |
The filesystem on /dev/sda1 is now 67108608 (4k) blocks long. | |
root@stg530:~# df -h . | |
Filesystem Size Used Avail Use% Mounted on | |
/dev/sda1 252G 101G 141G 42% / | |
root@stg530:~# exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment