On Sat, 13 Dec 2025 13:54:04 -0800, Doug Hardie wrote:
> I have a couple of Raspberry Pi 5s. One of which is a production server
> for mail. It works just fine. However, the disk structure is quite
> confusing. I only noticed this because of trying to bring up another
> similar server.
>
> If I list the dev entries for mmcsd, I get the following.
>
> mail# ll /dev/mmcs*
> crw-r----- 1 root operator 0x49 Nov 26 15:47 /dev/mmcsd0
> crw-r----- 1 root operator 0x4a Nov 26 15:47 /dev/mmcsd0s1
> crw-r----- 1 root operator 0x4b Nov 26 15:47 /dev/mmcsd0s2
> crw-r----- 1 root operator 0x4e Nov 26 15:47 /dev/mmcsd0s2a
> crw-r----- 1 root operator 0x4f Nov 26 15:47 /dev/mmcsd0s2b
>
> This looks like the drive was partitioned using GPT.
No, looks like MBR. Suffixes s[12] are the "DOS primary partitions",
i. e., the slices, and s2[ab] are the BSD partitions inside the 2nd
slice (the labels, disklabels).
GPT partitions would be listed as p[1234...].
> However, gpart list shows MBR.
Correct.
> I removed the non-relevant entries:
>
> mail# gpart list mmcsd0
> Geom name: mmcsd0
> entries: 4
> scheme: MBR
> Providers:
> 1. Name: mmcsd0s1
> Mediasize: 52428800 (50M)
> type: fat32lba
> 2. Name: mmcsd0s2
> Mediasize: 128124452864 (119G)
> type: freebsd
>
> There are the two partitions I expected. A boot partition, and a data
> partition.
At least the 2nd partition is FreeBSD. The other one seems to be DOS
(FAT32), which typically indicates something related to (U)EFI.
> Looking at the df output:
>
> mail# df -h
> Filesystem Size Used Avail Capacity Mounted on
> /dev/ufs/rootfs 108G 9.1G 90G 9% /
> devfs 1.0K 0B 1.0K 0% /dev
> /dev/msdosfs/EFI 50M 25M 25M 50% /boot/efi
> tmpfs 12G 85M 12G 1% /tmp
> /dev/da0s2 25G 1.3G 22G 6% /mailbkup
> mail#
>
> The entries for / and /boot/efi are not at all what I expected.
> The /mailbkup seems normal. How do I make sense of all this?
The partitions also have labels, and this is what you see in the
first column, instead of the device name. As I've guessed, the
/dev/mmcsd0s1 partition was labeled "EFI" and therefore became the
entry /dev/msdosfs/EFI, mounted at /boot/efi; the /dev/da0s2 seems
odd though... it should have been da0s2a because of /dev/mmcsd0s2a,
and /dev/mmcsd0s2b is a swap device (letter "b"), so it won't show
up in the mounted volume list (because it isn't mounted at all).
The letters for the labels indicate a boot partition ("a"), a swap
partition ("b"), the whole slice as a partition ("c"), and the
subsequent letters indicate further arbitrary partitions.
See this example:
% df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad10s1a 989M 438M 471M 48% /
devfs 1.0k 1.0k 0B 100% /dev
/dev/ad10s1d 989M 347M 563M 38% /tmp
/dev/ad10s1e 989M 407M 503M 45% /var
/dev/ad10s1f 48G 41G 3.3G 93% /usr
/dev/ad10s1g 4.9G 4G 505M 89% /opt
/dev/ad12 1.8T 1.7T 625M 100% /home
As you can see, ad12 (being ad12c in fact) is a data partition that
does not have any slices (called "dedicated"). Also swap isn't on
this list (ad10s1b).
> I duplicated the microSD card but it doesn't boot the new machine.
Using which tool? Note that GPT also might store stuff at the end of
a medium, so usually only real 1:1 copies work as expected.
> Messages shows the new disk is da1.
The device name is assigned according to detection order, that's
why labels are so convenient.
> mail# mount /dev/da1s2 /mnt
> mount: /dev/da1s2: No such file or directory
> mail# mount /dev/mmcsd1s2b /mnt
> mount: /dev/mmcsd1s2b: No such file or directory
Correct. You can not mount a slice, you need to mount a partition.
You also cannot mount a swap partition (see above).
The command should probably be:
# mount -t ufs -o ro /dev/da1s2a /mnt
or
# mount -t ufs -o ro /dev/mmcsd1s2b /mnt
Though -t ufs is the default, you can always make it explicit to
be sure. You also could use the label names, listed in /dev/ufs
or /dev/msdos (according to the file system); GPT labels exist
(if formatted GPT) in a different directory, /dev/gpt,
> I would like to verify that the new SD card is good.
A successful boot should prove it. ;-)
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...