Reputation: 6797
I tried to use parted for scripted partitionning like so :
parted -a optimal /dev/sda mklabel gpt mkpart primary ext4 1 -1
But it complains about -1 not being a recognized option. Still the same sub-command works in the parted prompt. So my question is how to use the same options in a script ?
Upvotes: 15
Views: 34279
Reputation: 6797
Finally found a solution :
parted -s -a optimal /dev/sda mklabel gpt -- mkpart primary ext4 1 -1s
--
is very important for it to work here.
Note the use of ‘--’, to prevent the following ‘-1s’ last-sector indicator from being interpreted as an invalid command-line option.
Upvotes: 30
Reputation: 796
You can also use --script option. In this case you should put your script part in single quotes.
Example:
parted --script /dev/sda 'mkpart primary ext4 1 -1'
Upvotes: 2
Reputation: 18243
I guess it's parted's argument parser's fault.
Try parted -a optimal /dev/sda mklabel gpt mkpart primary ext4 1 \-1
or parted -a optimal /dev/sda mklabel gpt mkpart primary ext4 1 \\-1
Upvotes: 0