LVM_DISK_Auto_Partition_Tools.sh 6.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. echo "------------------------------------------------------------------------------------------------------------------------------------------------------"
  3. echo -e "\033[33m LVM DISK Auto Partition Tools Version: 1.0.1 (20190622) \033[0m | Technical support provided by [ https://cxthhhhh.com ] "
  4. echo "------------------------------------------------------------------------------------------------------------------------------------------------------"
  5. echo -e "\033[33m 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 \033[0m"
  6. echo -e "\033[33m 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 \033[0m"
  7. echo -e "\033[33m 88888888888888888888888 8888888 888888 88 8888888 88888888 88888 8888 888 888 888888888888888888888888888 \033[0m"
  8. echo -e "\033[33m 88888888888888888888888 88888888 888888 888 888888 88888888 88888 888 888 888888888 88 88888888888888888888888888888 \033[0m"
  9. echo -e "\033[33m 88888888888888888888888 888888888 8888 8888 8 8888 8 88888888 8888888 888 888 88888888 8 888888888888888888888888888888 \033[0m"
  10. echo -e "\033[33m 88888888888888888888888 888888888 88 88888 88 88 88 88888888 8888888 888 88888 8888 8888888888888888888888888888888 \033[0m"
  11. echo -e "\033[33m 88888888888888888888888 8888888888 88 88888 888 8 888 88888888 888888 888 888888888 88 8 88888888888888888888888888888 \033[0m"
  12. echo -e "\033[33m 88888888888888888888888 88888888888 888888 888 888 88888888 88888 8888 8888888888 88 88 8888888888888888888888888888 \033[0m"
  13. echo -e "\033[33m 88888888888888888888888 888888 8888888 8888 8888 88888888 888888 888 888 8888 88888888888888888888888888 \033[0m"
  14. echo -e "\033[33m 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 \033[0m"
  15. echo -e "\033[33m 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 \033[0m"
  16. echo -e "\033[33m 88888888 888888888888888888888888888888888888888888888888 88888888888888888888888888888888888 88888888888 88888888888888888888888888888 \033[0m"
  17. echo -e "\033[33m 8888888 888888888888888888888 88888888888888888888888 888888888888888888888888 88888 8888 88888 88888888888888888888888888888 \033[0m"
  18. echo -e "\033[33m 888888 8 88888888888888888888 88888888888888888888888 8888 88888888888888888888888 888888888888 8888888888888888888888888888888888888 \033[0m"
  19. echo -e "\033[33m 88888 88 88888 88888 88 888 88888888 8888 88 8888 8 88 88 88 8888 8888 88 \033[0m"
  20. echo -e "\033[33m 8888 8888 8888 88888 8888 8888 88888 8888888 888888888 888 88888 88888 8888 88888 888 88888 888 8888 88 \033[0m"
  21. echo -e "\033[33m 888 888 88888 8888 8888 88888 8888888 8888888888 888 888888 88888 8888 88888 88 88888 888 8888 88 \033[0m"
  22. echo -e "\033[33m 888 888888 88 888 8888 8888 88888 88888888 888888888 8888 888 888888 8888 8888 88888 888 88888 888 8888 88 \033[0m"
  23. echo -e "\033[33m 88 8888888 888 8888 888 888888888 888888888 888 8888888 88 88888 88 8888 8888 8888 88 \033[0m"
  24. echo -e "\033[33m 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 \033[0m"
  25. echo "------------------------------------------------------------------------------------------------------------------------------------------------------"
  26. echo -e "\033[33m LVM DISK Auto Partition Tools Version: 1.0.1 (20190622) \033[0m | Technical support provided by [ https://cxthhhhh.com ] "
  27. echo "------------------------------------------------------------------------------------------------------------------------------------------------------"
  28. echo "Analyze Disk type (Virtual/Physical)......"
  29. sleep 5
  30. if [ -b /dev/vda1 ]; then
  31. echo "Disk type: Virtual Disk"
  32. echo "Recognition completed, waiting for disk response."
  33. echo "Automatic partitioning will take more than 2 minutes to complete."
  34. sleep 3s
  35. echo "n
  36. p
  37. 3
  38. t
  39. 3
  40. 8e
  41. w
  42. " | fdisk /dev/vda
  43. sleep 10s
  44. echo "In the partition (1/5), waiting for the disk response will take more than 30 seconds."
  45. partprobe
  46. sleep 20s
  47. echo "In the partition (2/5), waiting for the disk response will take more than 15 seconds."
  48. pvcreate /dev/vda3
  49. sleep 11s
  50. echo "In the partition (3/5), waiting for the disk response will take more than 15 seconds."
  51. vgextend centos /dev/vda3
  52. sleep 11s
  53. echo "In the partition (4/5), waiting for the disk response will take more than 15 seconds."
  54. lvextend -l +100%FREE /dev/mapper/centos-root
  55. sleep 11s
  56. echo "In the partition (5/5), waiting for the disk response will take more than 10 seconds."
  57. resize2fs -p /dev/mapper/centos-root
  58. sleep 6s
  59. else
  60. echo "Disk type: Physical Disk"
  61. echo "Recognition completed, waiting for disk response."
  62. echo "Automatic partitioning will take more than 2 minutes to complete."
  63. sleep 3s
  64. echo "n
  65. p
  66. 3
  67. t
  68. 3
  69. 8e
  70. w
  71. " | fdisk /dev/sda
  72. sleep 10s
  73. echo "In the partition (1/5), waiting for the disk response will take more than 30 seconds."
  74. partprobe
  75. sleep 20s
  76. echo "In the partition (2/5), waiting for the disk response will take more than 15 seconds."
  77. pvcreate /dev/sda3
  78. sleep 11s
  79. echo "In the partition (3/5), waiting for the disk response will take more than 15 seconds."
  80. vgextend centos /dev/sda3
  81. sleep 11s
  82. echo "In the partition (4/5), waiting for the disk response will take more than 15 seconds."
  83. lvextend -l +100%FREE /dev/mapper/centos-root
  84. sleep 11s
  85. echo "In the partition (5/5), waiting for the disk response will take more than 10 seconds."
  86. resize2fs -p /dev/mapper/centos-root
  87. sleep 6s
  88. fi
  89. echo "Automatic partition completion, Please restart."
  90. sleep 3s