[parted-devel] Automate parted command

Phillip Susi psusi at ubuntu.com
Mon Feb 3 14:53:44 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/3/2014 3:34 AM, 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

GPT does not have logical partitions.  You need to omit that argument,
and you need to specify a filesystem type instead ( ext2 ).

> 3. parted /dev/sda name 1 TEMP-1
> 
> I can put all these command directly in shell script.
> 
> But for 1st command *parted /dev/sdb mklabel gpt , *it will ask me 
> *Warning: The existing disk label on /dev/sdb will be destroyed and
> all data on this disk will be lost. Do you want* *to continue?* 
> *Yes/No?* if I say yes then *New disk label type?  [msdos]?*
> 
> But all these become interactive. Also if I use *-s* then it will 
> Instead of that is there any way to pass these answer to command
> through file. I don't want to use any third party tool like
> *expect*

If you use -s, then the warning is disabled and the remaining commands
execute just fine, when given on the command line.

> I was trying to pass all command through file to parted but it wont
> work.
>> cat parted.txt
> /dev/sdb mklabel gpt yes gpt
> 
>> parted < parted.txt

The first line is not a valid parted command.  Move the device name to
the parted argument list instead.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS7614AAoJEI5FoCIzSKrwhhMH/3L9buDMFiVHFgden4gCtsQo
0phkAUje9KtJj+szxnKM5drFwLew+SOSnWa8QPtqZU6VWSQFID5a435TbDzItSs+
5Hx1l8tbmTcbRMN08Vrwhox1Qlf/Jp8oBVnpIaciruxtwvjz26fYgr5vYsXSgoa2
GO1CUBR+NovFXo2t6y8SbVtllY8WRpczEsf5ujse44BqDBFpOpquoIugfH0npZUB
69qL+jYxa74Oy3ItuJnZ6iBXbpxEFQz2oUs41aX36edN/HsXM6URgvije7d3TV8o
ZY1+805VgsrukMBVL0qlL6MiDa9CU9Clcb9hjYXF/2X3Uv42Ui1IXHDczDweBJI=
=3kEV
-----END PGP SIGNATURE-----



More information about the parted-devel mailing list