Extend Partition and File system on Raspberry Pi

More Less
3 min readApr 18, 2019

Flashed an openwrt image to a 8GB sdcard, it only used 256M, the other 7.2GB are wasted.

Disk /dev/sda: 7.5 GiB, 8017412096 bytes, 15659008 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: 0x5452574f
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 8192 49151 40960 20M c W95 FAT32 (LBA)
/dev/sda2 57344 581631 524288 256M 83 Linux
Start End Sectors Size
2048 8191 6144 3M
49152 57343 8192 4M
581632 15659007 15077376 7.2G

To utilize the unallocated 7.2GB, we can use fdisk and to extend the existing partition.

1. Unmount the partition

pi@raspberrypi:~ $ umount /media/pi/06F7–6E7D
pi@raspberrypi:~ $ umount /media/pi/57f8f4bc-abf4–655f-bf67–946fc0f9f25b

2. Delete the partition

pi@raspberrypi:~ $ sudo fdisk /dev/sdaWelcome to fdisk (util-linux 2.29.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: 7.5 GiB, 8017412096 bytes, 15659008 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: 0x5452574f

--

--

More Less
More Less

Written by More Less

自由撰稿人,时评人,平等公义追求者

No responses yet