0

I am using CentOS 8 and added two nvme storage disks, which I want to configure in RAID1 mirror.

Following is lsblk output:

[root@localhost ~]# lsblk 
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  1.5T  0 disk 
├─sda1        8:1    0    1G  0 part /boot/efi
├─sda2        8:2    0    1G  0 part /boot
└─sda3        8:3    0  1.5T  0 part 
  ├─cl-root 253:0    0  1.5T  0 lvm  /
  └─cl-swap 253:1    0   32G  0 lvm  [SWAP]
nvme0n1     259:0    0  5.1T  0 disk 
nvme1n1     259:2    0  5.1T  0 disk 

When I am trying to add a partition to /dev/nvme0n1 and /dev/nvme1n1 respectively through fdisk, the partion being created in Linux filesystem by default, when I try to change the partition type to fd I get the following error:

Type of partition 1 is unchanged: "Linux filesystem"

Creating the partition process is going as following:

[root@localhost ~]# fdisk /dev/nvme0n1

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition number (1-128, default 1): 
First sector (34-5607509301657, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-5607509301657, default 5607509301657): 

Created a new partition 1 of type 'Linux filesystem' and of size 5.1 TiB

How can I configure the added storage partition in raid autodetect type while it is being created on Linux filesystem by default? .

10
  • 1
    What do you mean by fd? Is this type known to your fdisk? (answer L when it says Partition type or alias (type L to list all):). Commented Aug 6, 2021 at 22:07
  • @KamilMaciorowski Linux raid partition with autodetect using persistent superblock
    – Eng7
    Commented Aug 6, 2021 at 22:14
  • @KamilMaciorowski more info here: tldp.org/HOWTO/Partition-Mass-Storage-Definitions-Naming-HOWTO/…
    – Eng7
    Commented Aug 6, 2021 at 22:15
  • 2
    You are creating a GPT partition table rather than MBR, aren't you...? Commented Aug 6, 2021 at 22:34
  • 1
    You can use p to print partition table information. It will say Disklabel type: dos for MBR or Disklabel type: gpt for GPT. Commented Aug 7, 2021 at 5:54

1 Answer 1

1

fd is the type code used for Linux RAID by MBR partitioning schemes. But your disk is partitioned using the GPT scheme.

In GPT, the partition type is expressed as a GUID; in case of Linux RAID, the GUID would be

A19D880F-05FC-4D3B-A006-743F0F84911E

But that's inconvenient for humans, so most partitioning tools will default to other method rather than requiring you to enter the type GUID directly. In case of a modern, GPT-aware version of fdisk, it will present a numbered list of partition types it knows:

Command (m for help): t
Partition number (1-3, default 3): 2   # this will be omitted if there's only 1 partition
Partition type (type L to list all types): L

 1 EFI System                     C12A7328-F81F-11D2-BA4B-00A0C93EC93B
 2 MBR partition scheme           024DEE41-33E7-11D3-9D69-0008C781F39F
 3 Intel Fast Flash               D3BFE2DE-3DAF-11DF-BA40-E3A556D89593
 4 BIOS boot                      21686148-6449-6E6F-744E-656564454649
[...]
19 Linux swap                     0657FD6D-A4AB-43C4-84E5-0933C84B4F4F  
20 Linux filesystem               0FC63DAF-8483-4772-8E79-3D69D8477DE4
21 Linux server data              3B8F8425-20E0-4F3B-907F-1A25A76F98E8
22 Linux root (x86)               44479540-F297-41B2-9AF7-D131D5F0458A
23 Linux root (ARM)               69DAD710-2CE4-4E3C-B16C-21A1D49ABED3
24 Linux root (x86-64)            4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
25 Linux root (ARM-64)            B921B045-1DF0-41C3-AF44-4C6F280D3FAE
26 Linux root (IA-64)             993D8D3D-F80E-4225-855A-9DAF8ED7EA97
27 Linux reserved                 8DA63339-0007-60C0-C436-083AC8230908
28 Linux home                     933AC7E1-2EB4-4F13-B844-0E14E2AEF915
29 Linux RAID                     A19D880F-05FC-4D3B-A006-743F0F84911E
30 Linux extended boot            BC13C2FF-59E6-4262-A352-B275FD6F7172
31 Linux LVM                      E6D6D379-F507-44C2-A23C-238F2A3DF928
[...]

The exact numbers in the menu may vary between fdisk versions, but Linux RAID is the type you'll want for your RAID1 configuration. So here you would select number 29.

The HOWTO document you were following is from year 2009, when UEFI and GPT were still pretty much unknown with PCs: UEFI hit the mainstream with Intel's Sandy Bridge generation of CPUs in 2011, and brought along the ability to use GPT partitioning on boot disks.


If you are wondering why GPT has so many Linux partition types, you might want to know that there is an optional scheme, usable by modern enough versions of systemd, that allows you to designate a partition's purpose by using its GPT type GUID. If your system configuration is relatively simple, this may allow you to leave the /etc/fstab file completely empty and let the system auto-detect the required filesystems.

This may make some things easier for the administrators of massive fleets of auto-built VMs or cloud systems: they can prepare the OS root disk, /home disk and some other data disk separately, and then just stick them together into a single VM instance and the OS will figure it out as it boots.

You may read more about this scheme here: https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .