[parted-devel] Automate parted command

Brian C. Lane bcl at redhat.com
Mon Feb 3 16:18:54 UTC 2014


On Mon, Feb 03, 2014 at 02:04:47PM +0530, Sagar Shedge wrote:
> Respected Sir/Mam,
> 
> I want to make paritition creation using automate script. This script
> should avoid interaction and respond all question for parted command.
> Previous there will be msdos type partition table.
> 
> My command are as follows :-
> 1. parted /dev/sdb mklabel gpt
> 2. parted /dev/sdb mkpart logical 7168s 5638312959s
> 3. parted /dev/sda name 1 TEMP-1
> 
> I can put all these command directly in shell script.

Also note that you can put the commands all on one line, you don't need
to call parted multiple times. eg. gpt partition a disk.img into 2
partitions:

parted -s disk-1.img mklabel gpt mkpart part1 ext4 1M 50% \
mkpart part2 ext4 50% 100% print


-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)



More information about the parted-devel mailing list