I have burnt an image on a 32gb SD card and about 28gb was unallocated. I have used the disk utility on the unallocated space and made him ext4 28gb.

now, I wish to extended the primary ext4 partition with my new partition. I have tried doing it with resize2fs but got this: this is the output i get:

enter image description here

How can I resize the primary partition on runtime correctly?

Thanks for the answers


For me it looks like the space is occupied form the partition 3 (/dev/mmcblk0p3).

If I understood correctly what you want to do, you have to delete the 3rd partition and then you can extent the 2nd (/dev/mmcblk0p2).


what exactly are you trying to do? combine the two filesystems? From the output of fdisk it seems like you have three filesystems on that device, a small FAT, a 4Gb linux and a 28Gb linux filesystem.

In case I understand correctly what you want to do:

If you previously had 28GB of unallocated space you should not have created that new 28GB partition, instead you should use a utility such as gparted to extend the 4GB partition to maximum size. Now that you have, (assuming that it is empty of course) delete that empty 28Gb partition and extend the small 4Gb partition to use the whole device. Unmount any involved filesystems before you start to be safe. gparted is graphical and user-friendly. Just make sure you select the correct device.

Well, you should delete the extra 28GB partition first. Then I guess you could use parted (the command line tool) to resize the first partition. But this is dangerous if you dont know exactly what you are doing, so I personally only use gparted. If you dont have parted you could change the size of the partition with fdisk but only if you are an expert, because you will have to mark the layout of all partitions, delete them and recreate them with exactly the same parameters for the partition start (down to sector position) and modify the end so that it fills the device. And if you lose power during the process or reboot without having fixed the partition table the system will become unusable. Also I dont know if you will be able to run resize2fs on your 4GB partition if that is the partition that is mounted on /

I think the safest way for you to fix this is to shutdown your embedded system take the SD card from it and put it in a card reader on an ubuntu PC that has gparted, or boot an ubuntu installation CD/DVD on a PC without ubuntu and use gparted from there to modify the partition of the SD card (make sure you select the SD and not the PC's hard drive)

  • Hey, Thanks for your answer. I cannot download GParted currently because I miss a kernel package.. i just have the basic tools which come with ubuntu. I wish to add these 28GB to the 4GB linux partition. Is there anyway of doing this on runtime? (they OS plays from the 4GB linux.. moreover, I dont have a CD-ROM because it's an embedded system)
    – pugilon
    Jun 21 '15 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.