ScAlAn

How to expand partition size on Raspberry Pi Ubuntu disk

Task: expand root partition.

After writing image on sd card I see 3.8GB partition size. I have 14GB sd card.

To use all space use next linux commands:

$ sudo fdisk /dev/mmcblk0       

Welcome to fdisk (util-linux 2.31.1).                                                                              
Changes will remain in memory only, until you decide to write them.                                                
Be careful before using the write command.


Command (m for help): d        
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
  p   primary (1 primary, 0 extended, 3 free)
  e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):  
First sector (526336-15278079, default 526336):  
Last sector, +sectors or +size{K,M,G,T,P} (526336-15278079, default 15278079):  

Created a new partition 2 of type 'Linux' and of size 7 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

$ sudo resize2fs /dev/mmcblk0p2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mmcblk0p2 is mounted on /media/user/writable; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 1843968 (4k) blocks long.

Done.

Leave a Reply

Your email address will not be published. Required fields are marked *