Raspberry Pi with Kali 2.0 and Expand SD Drive Space
Have extra space on your micro SD card but are not seeing it. No big deal, simply run the commands below to expand your drive space.
root@kali:~# df -h Filesystem Size Used Avail Use% Mounted on rootfs 2.9G 1.5G 1.2G 56% / /dev/root 2.9G 1.5G 1.2G 56% / devtmpfs 460M 0 460M 0% /dev tmpfs 93M 468K 93M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 186M 0 186M 0% /run/shm
See above how only 1.2G of space is being used.
root@kali:~# wget http://www.alexrams.com/blog/wp-content/uploads/2015/11/raspi-expand-rootfs.sh root@kali:~# fdisk -l Disk /dev/mmcblk0: 28.8 GiB, 30908350464 bytes, 60367872 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: 0x000cdbaa Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 1 125000 125000 61M c W95 FAT32 (LBA) /dev/mmcblk0p2 125001 60366847 60241847 28.7G 83 Linux
Most likely via fdisk -l
the starting sector of partition 2 will be “125001”. The script provided above has already made the adjustment.
root@kali:~# chmod +x raspi-expand-rootfs.sh root@kali:~# sh raspi-expand-rootfs.sh root@kali:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 29G 4.4G 23G 17% / devtmpfs 369M 0 369M 0% /dev tmpfs 373M 0 373M 0% /dev/shm tmpfs 373M 5.5M 367M 2% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 373M 0 373M 0% /sys/fs/cgroup tmpfs 75M 4.0K 75M 1% /run/user/0 tmpfs 75M 4.0K 75M 1% /run/user/110 tmpfs 75M 0 75M 0% /run/user/1000 root@kali:~# reboot