Created
September 16, 2021 10:23
-
-
Save izonder/1c14b61be91db1d12ac3cdccae1575e1 to your computer and use it in GitHub Desktop.
Extending partition
This file contains hidden or 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
# fdisk -l | |
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 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 | |
Disklabel type: dos | |
Disk identifier: 0xa236c89b | |
Device Boot Start End Sectors Size Id Type | |
/dev/vda1 * 2048 201326591 201324544 96G 83 Linux | |
/dev/vda2 201326592 209715199 8388608 4G 82 Linux swap / Solaris | |
# swapoff /dev/vda2 | |
# fdisk /dev/vda | |
# d - delete both partitions | |
# n - create primary partition 1 with ext4 (type 83), side +196G | |
# a - mark partition as bootable | |
# n - create 2 primary partition | |
# t - change type partition 2 to swap (type 82) | |
Command (m for help): p | |
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 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 | |
Disklabel type: dos | |
Disk identifier: 0xa236c89b | |
Device Boot Start End Sectors Size Id Type | |
/dev/vda1 * 2048 411043839 411041792 196G 83 Linux | |
/dev/vda2 411043840 419430399 8386560 4G 82 Linux swap / Solaris | |
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). | |
# reboot | |
# resize2fs /dev/vda1 | |
resize2fs 1.42.13 (17-May-2015) | |
Filesystem at /dev/vda1 is mounted on /; on-line resizing required | |
old_desc_blocks = 6, new_desc_blocks = 13 | |
The filesystem on /dev/vda1 is now 51380224 (4k) blocks long. | |
# blkid | |
/dev/vda1: UUID="ed850358-01f6-4bb0-9121-7632dd3970d8" TYPE="ext4" PARTUUID="a236c89b-01" | |
/dev/vda2: PARTUUID="a236c89b-02" | |
# cat /etc/fstab | |
# /etc/fstab: static file system information. | |
# | |
# Use 'blkid' to print the universally unique identifier for a | |
# device; this may be used with UUID= as a more robust way to name devices | |
# that works even if disks are added and removed. See fstab(5). | |
# | |
# <file system> <mount point> <type> <options> <dump> <pass> | |
UUID=ed850358-01f6-4bb0-9121-7632dd3970d8 / ext4 errors=remount-ro 0 1 | |
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0 | |
UUID=c6a66cfd-4502-45a6-88aa-09db16f1342b none swap sw 0 0 | |
# mkswap /dev/vda2 | |
Setting up swapspace version 1, size = 4 GiB (4293914624 bytes) | |
no label, UUID=ce27b1d2-b933-4270-95a9-fdadfba0d205 | |
# blkid | |
/dev/vda1: UUID="ed850358-01f6-4bb0-9121-7632dd3970d8" TYPE="ext4" PARTUUID="a236c89b-01" | |
/dev/vda2: UUID="ce27b1d2-b933-4270-95a9-fdadfba0d205" TYPE="swap" PARTUUID="a236c89b-02" | |
# swapon -U ce27b1d2-b933-4270-95a9-fdadfba0d205 | |
# mcedit /etc/fstab | |
# cat /etc/fstab | |
# /etc/fstab: static file system information. | |
# | |
# Use 'blkid' to print the universally unique identifier for a | |
# device; this may be used with UUID= as a more robust way to name devices | |
# that works even if disks are added and removed. See fstab(5). | |
# | |
# <file system> <mount point> <type> <options> <dump> <pass> | |
UUID=ed850358-01f6-4bb0-9121-7632dd3970d8 / ext4 errors=remount-ro 0 1 | |
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0 | |
UUID=ce27b1d2-b933-4270-95a9-fdadfba0d205 none swap sw 0 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment