I'm looking for a way to change a partition type on a linux system without starting fdisk. (In this particular case from "linux" to "softwareRAID")
The ultimate goal here is a script that is going to take /dev/sda and automatically create a software RAID1 with /dev/sdb
I'm not looking for anyone here to write me a script, just trying to provide some info changing the partition type in a script. I can take care of the rest.
Thanks in advance.
or you could use sfdisk, it's also designed to be scriptable.
e.g. to change partition 1 of /dev/sda to type 0xfd (linux raid):
you can also dump out an existing partition table to a file (in a format that is intended to be re-imported back into sfdisk), then modify that file with vi/awk/sed/perl/ed/whatever and then feed it back in to sfdisk.
e.g.
i often use that when building raid arrays of identical disks. manually create the partition table on one drive then use sfdisk to copy it to the other drives.
I would look into parted, it is easily scriptable
Use parted. You can script it, and it won't make you reboot :)
If you're looking to clone a partition table,
dd bs=512 count=1 if=/dev/sda of=/dev/sdb; partprobe /dev/sdb
is the easiest way.