parted 工具分区 非交互式
• fdisk(变体:cfdisk,sfdisk),MBR格式分区工具,只能识别2Tb以内的磁盘空间。
• gdisk(变体:cgdisk,sgdisk),GPT格式分区工具。
• parted(图形界面工具:gparted),同时支持MBR及GPT的分区工具。
parted有个不提示用户参数选项,就是通过这个选项来实现非交互
-s, --script
never prompts for user intervention
parted -s /dev/sdc mklabel gpt
parted -s /dev/sdc mkpart primary 0% 25%
parted -s /dev/sdc mkpart primary 25% 50%
parted -s /dev/sdc mkpart primary 50% 75%
parted -s /dev/sdc mkpart primary 75% 100%
for i in {b..d};do parted -s /dev/sd$i mkpart primary 0% 25% && parted -s /dev/sd$i mkpart primary 25% 50% && parted -s /dev/sd$i mkpart primary 50% 75% && parted -s /dev/sd$i mkpart primary 75% 100% ;done
参考:
https://blog.csdn.net/a985588764/article/details/121223472
http://www.manongjc.com/detail/25-mlfenidfasxbkaw.html
https://blog.csdn.net/aixueai/article/details/120533315