Step 1
aptitude install fdisk
How did I install sfdisk
to Debian 12?
Step 2
sfdisk -d /dev/sdb > sdb_partitions.txt
The output:
label: dos
label-id: 0x00066c32
device: /dev/sdb
unit: sectors
sector-size: 512
/dev/sdb1 : start= 2048, size= 33554433, type=fd
/dev/sdb2 : start= 33558528, size= 1048577, type=fd
/dev/sdb3 : start= 34609152, size= 434250929, type=fd
Step 3
sfdisk /dev/sda < sdb_partitions.txt
The output:
Checking that no-one is using this disk right now ... OK
Disk /dev/sda: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Micron_1100_MTFD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS (MBR) disklabel with disk identifier 0x00066c32.
/dev/sda1: Created a new partition 1 of type 'Linux raid autodetect' and of size 16 GiB.
/dev/sda2: Created a new partition 2 of type 'Linux raid autodetect' and of size 512 MiB.
/dev/sda3: Created a new partition 3 of type 'Linux raid autodetect' and of size 207.1 GiB.
/dev/sda4: Done.
New situation:
Disklabel type: dos
Disk identifier: 0x00066c32
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 33556480 33554433 16G fd Linux raid autodetect
/dev/sda2 33558528 34607104 1048577 512M fd Linux raid autodetect
/dev/sda3 34609152 468860080 434250929 207.1G fd Linux raid autodetect
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Step 4
mdadm --manage /dev/md0 --add /dev/sda1
mdadm --manage /dev/md1 --add /dev/sda2
mdadm --manage /dev/md2 --add /dev/sda3
Step 5
cat /proc/mdstat
Wait for the RAID synchronization.
Step 6
grub-install /dev/sda
The output:
Installing for i386-pc platform.
Installation finished. No error reported.
Step 7
update-grub
The output:
Generating grub configuration file ...
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
Found linux image: /boot/vmlinuz-6.1.0-13-amd64
Found initrd image: /boot/initrd.img-6.1.0-13-amd64
Found linux image: /boot/vmlinuz-4.19.0-13-amd64
Found initrd image: /boot/initrd.img-4.19.0-13-amd64
Found linux image: /boot/vmlinuz-4.9.0-4-amd64
Found initrd image: /boot/initrd.img-4.9.0-4-amd64
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
done
Step 8
parted /dev/sda print
parted /dev/sda
unit GiB
mkpart primary 224 100%
print
quit
mkfs.ext4 /dev/sda4
mkdir /sda4
mount /dev/sda4 /sda4
df -h | grep /sda4
blkid /dev/sda4