  fssize=$(echo $v_secondary_partition | tr -d '[:alpha:]')

  case $unit in
    K) unit=KB ;;
    M) unit=MB ;;
    G) unit=GB ;;
    T) unit=TB ;;
  esac

  # Check if there is enough space left at end of the disk
  disk_free=$(parted --machine --script $v_disk unit ${unit} print free | grep ":free" | tail -n 1 | cut -d ':' -f 4 | tr -d '[:alpha:]')
  if [ $((disk_free-fssize)) -lt 0 ]; then
    echo "Not enough free space left on disk for a $v_secondary_partition partition. Maximum space left is ${disk_free}${unit}"
    exit 1
  fi