On 4/12/2017 6:43 AM, maze...@free.fr wrote: > I'm trying to use the possibility of mkpart to specify the file system type, > with the non interactive interface (--script) > > First point is pure documentary : > https://www.gnu.org/software/parted/manual/parted.html#mkpart indicates : > mkpart [part-type fs-type name] start end > > man mkpart indicates: > mkpart [part-type name fs-type] start end > > name and fstype have been switched between the two docs. > All versions 3.2 !?? > Anyways, it seems that using the name always fail
The docs have been fixed for about a year now and will appear in the next release. The msdos partition table does not support names. > Second point : > I expect this line > #parted --script /dev/sda unit s mkpart primary ext4 2048 208896 > > to create a partition with a file system set as ext4. > > I don't expect it to be initialized, but just to have the display like : > Number Start End Size Type File system Flags > 1 2048s 208896s 206849s primary ext4 lba > > Instead I get this : > Number Start End Size Type File system Flags > 1 1049kB 107MB 106MB primary That is because the partition in fact, contains no filesystem. Parted used to re-read the disk after every command, but in the next release, will no longer do this and so will preserve the "ext4" filesystem setting until you restart parted. > Now using the commdand console interface everything is ok : > # parted /dev/sda > GNU Parted 3.2 > Using /dev/sda > Welcome to GNU Parted! Type 'help' to view a list of commands. > (parted) unit s mkpart primary ext4 2048 208896 > (parted) p > Model: ATA ST32000641AS (scsi) > Disk /dev/sda: 3907029168s > Sector size (logical/physical): 512B/512B > Partition Table: msdos > Disk Flags: > > Number Start End Size Type File system Flags > 1 2048s 208896s 206849s primary ext4 lba > > > This should be part of an automated workflow. > > I've also tested things like > echo "unit s mkpart primary ext4 2048 208896 q" | parted --script > /dev/sda > and > parted --script /dev/sda <<< "unit s mkpart primary ext4 2048 208896 q" > without success. > > It also fails without --script. > > What am I missing ? parted --script /dev/sda unit s mkpart primary ext4 2048 208896 q