I'm trying to change the partition type with the following command :
sudo sfdisk --change-id /dev/sdb 2 fdHowever, I get the following error :
sfdisk: /dev/sdb: partition 2: failed to set partition typeThis is how my drives look like :
Any idea how to solve this ?
I have one disk with ubuntu server. Everything installed and configured, which took me a lot of time. Now I want to add a disc and create a RAID1 array ... without losing my system on disk 1. = lot's of troubles. There are plenty of guides out there, but none of them in case you are bound to an uefi partition. So I'm doing some tests with a VM in order to accomplish this. This is my grand masterplan : (which might be stupid)
1 clone SDA to SDB as exact copies, each with own efi partition 2 convert SDB2 to a raid linux partition = md0 , degraded 3 point grub config to md0 instead of sda2 (on both drives efi partition) 4 convert and add SDA2 to raid array
That's the short version. In step 2, I need first to change the partition type to raid.I'm partly following this guide ;
In order to setup raid, I must set the partition type to FD
11 Answer
If you really want to change the partition type of this partition, see the following:
The sfdisk-command --change-id is deprecated and you should use --part-type instead.
From man sfdisk:
--part-type device partition-number [type] Change the partition type. If type is not specified, then print the current partition type. The type argument is hexadecimal for MBR, or a GUID for GPT. For backward compatibility the options -c and --id have the same meaning as this one.
As you use GPT sfdisk expects a GUID and not a dos partition type.
You can find the GUID for the different partition types here:
You have to replace fd (which would be valid if you use dos partition table) with it's counterpart for GPT, so the correct command is
sudo sfdisk --part-type /dev/sdb 2 A19D880F-05FC-4D3B-A006-743F0F84911EAnd here another interesting link:
In addition you should also change the UUID's of the cloned file-systems. When the system boots it will try to mount the Efi System Partition and the OS-partition using UUID's, the first partition found with the UUID used in /etc/fstab will be mounted and you can not be sure which of the two partitions with the same UUID is that.
To change the UUID of a partition use something like
tune2fs -U UUID /dev/sdb2where UUID is a UUID of your choice or the keyword random to generate a new random UUID. Take a look at man tune2fs.