Created
March 30, 2016 05:38
-
-
Save vanhalt/baffe5becd1914867b9caad40db73f50 to your computer and use it in GitHub Desktop.
Revisions
-
vanhalt created this gist
Mar 30, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ Installation --- Installation steps: http://docs.kali.org/kali-on-arm/install-kali-linux-arm-raspberry-pi ARM download site: https://www.offensive-security.com/kali-linux-arm-images/ If `dd`ing from OSX do the [following for speed](http://daoyuan.li/solution-dd-too-slow-on-mac-os-x/): ```bash $ dd bs=1m if=kali-2.1.2-rpi2.img of=/dev/rdisk2 7000+0 records in 7000+0 records out 7340032000 bytes transferred in 514.267776 secs (14272782 bytes/sec) # fast! ``` I had a 32GB SD card, this image transform it to a 7GB memory. To fix to the following (inspired by [this](https://linhost.info/2015/05/expand-the-root-partition-in-kali-linux-for-the-raspberry-pi/): ``` $ cd /boot $ wget https://raw.githubusercontent.com/lgierth/pimesh/master/files/raspi-expand-rootfs.sh # Check the partitions # replace $PART_START with 125001 if fdisk -l shows: ... /dev/mmcblk0p2 125001 60367871 60242871 28.7G 83 Linux ... $ chmod -x raspi-expand-rootfs.sh $ sh raspi-expand-rootfs.sh $ reboot ``` After successful reboot, run: ``` $ resize2fs /dev/mmcblk0p2 ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ #!/bin/sh # # Taken from http://www.raspberryvi.org/wiki/doku.php/raspi-expand-rootfs # # Resize the root filesystem of a newly flashed Raspbian image. # Directly equivalent to the expand_rootfs section of raspi-config. # No claims of originality are made. # Mike Ray. Feb 2013. No warranty is implied. Use at your own risk. # # Run as root. Expands the root file system. After running this, # reboot and give the resizefs-once script a few minutes to finish expanding the file system. # Check the file system with 'df -h' once it has run and you should see a size # close to the known size of your card. # # Get the starting offset of the root partition PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^2" | cut -f 2 -d:) [ "$PART_START" ] || return 1 # Return value will likely be error for fdisk as it fails to reload the # partition table because the root fs is mounted fdisk /dev/mmcblk0 <<EOF p d 2 n p 2 $PART_START p w EOF # now set up an init.d script cat <<\EOF > /etc/init.d/resize2fs_once && #!/bin/sh ### BEGIN INIT INFO # Provides: resize2fs_once # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 S # Default-Stop: # Short-Description: Resize the root filesystem to fill partition # Description: ### END INIT INFO . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting resize2fs_once" && resize2fs /dev/mmcblk0p2 && rm /etc/init.d/resize2fs_once && update-rc.d resize2fs_once remove && log_end_msg $? ;; *) echo "Usage: $0 start" >&2 exit 3 ;; esac EOF chmod +x /etc/init.d/resize2fs_once && update-rc.d resize2fs_once defaults && echo "Root partition has been resized. The filesystem will be enlarged upon the next reboot"