SHARE
TWEET

modified resize_rootfs.sh

fire219 Aug 6th, 2016 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. set -e
  3.  
  4. if [ "$(id -u)" -ne "0" ]; then
  5.         echo "This script requires root."
  6.         exit 1
  7. fi
  8.  
  9. set -x
  10.  
  11. DEVICE="/dev/mmcblk0"
  12. PART="2"
  13.  
  14. resize()
  15. {
  16.         start=$(fdisk -l ${DEVICE}|grep ${DEVICE}p${PART}|awk '{print $2}')
  17.         echo $start
  18.  
  19.         set +e
  20.         fdisk ${DEVICE} <<EOF
  21. p
  22. d
  23. 5
  24. d
  25. 2
  26. n
  27. e
  28. 2
  29. $start
  30.  
  31. n
  32. l
  33.  
  34.  
  35. w
  36. EOF
  37.         set -e
  38.  
  39.         partx -u ${DEVICE}
  40.         resize2fs ${DEVICE}p5
  41. }
  42.  
  43. resize
  44.  
  45. echo "Done!"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top