I'm using Kali 2.1 on RPi2 (armhf) and I've got problem with expanding my root partition from 3GB to 28GB

When I try to expand via GParted it's saying that the partition is mounted:

error: e2fsck -f -y -v -C 0 /dev/mmcblk0p2

I also try to expand via raspi-config and rpi-wiggle.sh but it gives me this error:

First sector (125001-62333951, default 126976): Value out of range

I have 32GB SD Card and it's useless because of this.

  • and when i go through this tut(youtube.com/watch?v=R4VovMDnsIE), when i reboot the Pi, the screen is just flashing and nothing shows up Oct 13, 2015 at 20:03
  • Sounds like you have a bad image or bad card. Resizing should work through raspi-config after a reboot.
    – scruss
    Mar 20, 2016 at 13:53

2 Answers 2


gparted already told you what's the problem: the partition is mounted!

you can only manipulate partitions which are not mounted (= "in use")! - so please unmount the partition an try it again...

but unmounting the used root-partition is impossible: so in this case you have to use another system (or live-system) then attach the storage you want to manipulate (in case it is auto-mounted unmount it) and gparted will work as expected.

  • and don't forget: ...but first make a backup!!! Oct 14, 2015 at 1:37
  • so how can i use live system on pi if it's only allowed 1 sd card at a time Oct 14, 2015 at 7:29
  • if you want/have to do this task with a RPi the easiest would be to use a other SD card for the OS and then attach the SD card you want to manipulate with a SD card reader to the USB hub. Oct 14, 2015 at 7:39
  • 2
    That is not true, you can expand /root while using it. Oct 22, 2015 at 14:14
  • nice comment. how?
    – user236012
    Oct 22, 2015 at 14:42

Please provide your partition table fdisk -l? If your root partition is boxed in by other partitions you need to move them first.

This is what I normmally use to expand the root file system;

PART_START=$(parted $DRIVE -ms unit s p | grep "^2" | cut -f 2 -d:)
[ "$PART_START" ] || exit 1
fdisk /dev/mmcblk0 <<EOF

) > /dev/null 2>&1
shutdown -r now
resize2fs /dev/mmcblk0p2

This script can be used on the rpi it is resizing. It assumes the root partition is the last one and it's name is hard coded. backup before use. Read the man pages for extended details.

  • 2
    While this may work, it could hose the system because you hard coded the partition., also you don't explain how to use this script. Oct 13, 2015 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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