resize_root.sh 842 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. DEVICE="/dev/mmcblk0"
  3. ROOT_PARTITION="${DEVICE}p1"
  4. ROOT_PARTITION="1"
  5. echo "Warning : this an early version to resize the root partition. Check the source code to ensure what you are doing."
  6. if [ ${1} = "force" ]; then
  7. #Check dependency
  8. hash growpart
  9. if [ ${?} -ne 0 ]; then
  10. echo "install cloud-utils-growpart first. Hint : dnf install cloud-utils-growpart"
  11. exit 1
  12. fi
  13. #Check the partition :
  14. e2fsck -f ${ROOT_PARTITION}
  15. #Change the size : BUG: app doesn't support "octet".
  16. LC_ALL=C growpart ${DEVICE} ${ROOT_PARTITION}
  17. #Resize the partition with the new size :
  18. resize2fs ${ROOT_PARTITION}
  19. #Sync (just to be sure)
  20. sync
  21. else
  22. echo "If you read the source code, you should not have read that message... Exiting with out touching the partition."
  23. fi
  24. #Quit
  25. exit 0