Expand Raspbian Partition: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
Created page with "I usually expand the partition to 4GB form the default 3GB so I can re-image my installs. Once I've finished building my image I then expand the partition to maximum using th..." |
No edit summary |
||
Line 1: | Line 1: | ||
I | = Modify Partition = | ||
I usually expand the partition to 4GB form the default 2GB so I can re-image my installs. Once I've finished building my image I then expand the partition to maximum using the raspi-cofig utility.<br> | |||
* Delete partition 2. Making notice of where it starts. | |||
* Create a new primary partition with the same starting block and finish at block 8388608 | |||
<pre> | <pre> | ||
fdisk /dev/mmcblk0 | fdisk /dev/mmcblk0 | ||
</pre> | |||
== Before == | |||
<pre> | |||
Disk /dev/mmcblk0: 29.91 GiB, 32111591424 bytes, 62717952 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: 0x0ee3e8a8 | |||
Device Boot Start End Sectors Size Id Type | |||
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) | |||
/dev/mmcblk0p2 532480 3907583 3375104 1.6G 83 Linux | |||
</pre> | |||
== After == | |||
<pre> | |||
Disk /dev/mmcblk0: 29.91 GiB, 32111591424 bytes, 62717952 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: 0x0ee3e8a8 | |||
Device Boot Start End Sectors Size Id Type | |||
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) | |||
/dev/mmcblk0p2 532480 8388608 7856129 3.7G 83 Linux | |||
</pre> | </pre> | ||
= Expand New Partiion = | |||
<pre> | <pre> | ||
resize2fs /dev/mmcblk0p2 | resize2fs /dev/mmcblk0p2 | ||
</pre> | |||
Output | |||
<pre> | |||
resize2fs 1.46.2 (28-Feb-2021) | |||
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required | |||
old_desc_blocks = 1, new_desc_blocks = 1 | |||
The filesystem on /dev/mmcblk0p2 is now 982016 (4k) blocks long. | |||
</pre> | </pre> | ||
[[Category : raspbian]] [[Category : Raspberry Pi]] | [[Category : raspbian]] [[Category : Raspberry Pi]] |
Latest revision as of 04:41, 3 August 2022
Modify Partition
I usually expand the partition to 4GB form the default 2GB so I can re-image my installs. Once I've finished building my image I then expand the partition to maximum using the raspi-cofig utility.
- Delete partition 2. Making notice of where it starts.
- Create a new primary partition with the same starting block and finish at block 8388608
fdisk /dev/mmcblk0
Before
Disk /dev/mmcblk0: 29.91 GiB, 32111591424 bytes, 62717952 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: 0x0ee3e8a8 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 532480 3907583 3375104 1.6G 83 Linux
After
Disk /dev/mmcblk0: 29.91 GiB, 32111591424 bytes, 62717952 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: 0x0ee3e8a8 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 532480 8388608 7856129 3.7G 83 Linux
Expand New Partiion
resize2fs /dev/mmcblk0p2
Output
resize2fs 1.46.2 (28-Feb-2021) Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mmcblk0p2 is now 982016 (4k) blocks long.