2

I'm currently involved in modifying some system setup scripts to use parted rather than sfdisk, and I'm not entirely sure how to convert those commands.

The existing sfdisk command is passed numeric partition-type identifiers; I'm reasonably sure it can only be 82 ("Linux swap") or 83 ("Linux native partition"). For example:

$ sfdisk /dev/sda << EOT
0,100,83,
100,200,82,
EOT

How would I express this configuration to parted? My best guess at the moment would be:

$ parted /dev/sda mkpart primary 0 100 mkpart primary linux-swap 100 200

A lot of my confusion stems from parted's seeming treatment of a Linux swap partition as a type of filesystem, while the fact that it has an assigned partition type ID seems to make it a type of partition.

Sean
  • 137
  • 1
  • 6

1 Answers1

1

You may want to specify units to mkpart command:

mkpart primary linux-swap 100cyl 200cyl

All specific partition types are hidden in parted, to change first partition to type 0x82 (linux-swap) you would use:

toggle 1 swap

Or for MD RAID (0xFD):

toggle 1 raid

or use set:

set 1 swap on
set 1 raid on
Hubert Kario
  • 6,351
  • 6
  • 33
  • 65