0

On my Raspbian (Jessie) system sudo sfdisk -lV /dev/mmcblk0 (sfdisk from util-linux 2.25.2) shows me

Disk /dev/mmcblk0: 3923936 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/mmcblk0p1        128    2143    2016      64512    e  W95 FAT16 (LBA)
                start: (c,h,s) expected (128,0,1) found (0,130,3)
                end: (c,h,s) expected (1023,3,16) found (8,138,2)
/dev/mmcblk0p2       2144  329823  327680   10485760   83  Linux
                start: (c,h,s) expected (1023,3,16) found (8,138,3)
                end: (c,h,s) expected (1023,3,16) found (1023,254,63)
/dev/mmcblk0p3     329824  591967  262144    8388608   83  Linux
                start: (c,h,s) expected (1023,3,16) found (1023,254,63)
                end: (c,h,s) expected (1023,3,16) found (1023,254,63)
/dev/mmcblk0p4     591968  3497439  2905472   92975104    7  HPFS/NTFS/exFAT
                start: (c,h,s) expected (1023,3,16) found (1023,254,63)
                end: (c,h,s) expected (1023,3,16) found (1023,254,63)
sfdisk: Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
sfdisk: start of partition 1 has impossible value for head: 130 (should be in 0-3)

However on my VirtualBox Debian (stretch / testing) guest system running on a Windows 10 host with the SDXC card plugged in via an old USB 2.0 card reader sudo sfdisk -lV /dev/sdc (sfdisk from util-linux 2.29.1) shows

Disk /dev/sdc: 119.8 GiB, 128579534848 bytes, 251131904 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x102c03ad

Device     Boot    Start       End   Sectors  Size Id Type
/dev/sdc1           8192    137215    129024   63M  e W95 FAT16 (LBA)
/dev/sdc2         137216  21108735  20971520   10G 83 Linux
/dev/sdc3       21108736  37885951  16777216    8G 83 Linux
/dev/sdc4       37885952 223836159 185950208 88.7G  7 HPFS/NTFS/exFAT
Remaining 27295744 unallocated 512-byte sectors.

I have created the SD card form a recent Raspbian image with this USB adapter and added more partitions later.

Why does Raspbian report something different? What does c,h,s and impossible value mean? It doesn't look right. Should it worry me?

  • 2
    This is just speculation, but since your card obviously is quite big (an SDXC card), it could be that its your USB adapter that is at fault. Maybe it's not prepared for SDXC cards, but goes ahead while making wrong assumptions about the card. The SD card standard has gone through a lot of growing pains through the years. Mass storage device designers seem to be the worst visionaries in the world, unable to anticipate the need to support inevitably growing storage sizes for longer than six months ahead. – Johan Myréen Mar 30 '17 at 7:36
  • Thanks for your comment. How can I verify the USB card reader? In case this problem could also be related to accessing the USB card reader through a VirtualBox guest system, I have added this information to my question. – Frank Breitling Mar 30 '17 at 9:30
  • 1
    As I said, this is speculation, but what alerted me was that the RPi reports 1024 byte blocks, whereas the USB reader reports 512 byte blocks. This can be a mapping issue, though. The USB reader does contain electronics to do a mapping from an SD card interface to USB mass storage, so it contains firmware that needs to know how to interpret the SDXC card protocol and registers. The reader does not contain just wires. I guess the safe thing is to buy a reader that advertises that it is compatible with SDXC. My gut feeling is that VirtualBox is not the problem here, but you never know. – Johan Myréen Mar 30 '17 at 11:01
3

Should it worry me?

No. It's generally irrelevant for Linux. Unless you've noticed your system doesn't boot because the bootloader relies on (c,h,s) values.

The newer version of sfdisk removes any code for handling (c,h,s). From the manpage, I understand the DOS backwards compatibility modes have been removed.

E.g. https://karelzak.blogspot.co.uk/2014/10/new-sfdisk.html

If you still rely on old default cylinders than be careful with update. Frankly, LBA addressing is mandatory since ATA-3 (1997) and supported by Linux since beginning.

(Partition types for LBA mode have been available since MS Windows 95. The significance of cylinder boundaries appears to have been discarded by Windows Vista and newer).

  • Thanks for your answer. But can you be a bit more explicit how it answers my questions? – Frank Breitling Mar 30 '17 at 12:35
  • @FrankBreitling edited. – sourcejedi Mar 30 '17 at 12:48
  • 1
    I would be a bit worried why sfdisk on the RPi reports that the partition table contains garbage, even though the c,h,s geometry isn't used. To me that is a sign that the partition table isn't read or written correctly. But if it works, then maybe this is just a glitch that can be ignored. – Johan Myréen Mar 30 '17 at 13:55
  • 1
    @FrankBreitling note that the values "3923936 cylinders, 4 heads, 16 sectors/track" do not come from the partition table. Linux at least used to ask the BIOS at boot time. This is unlikely to be a useful source for removable SD cards & on systems without a BIOS. The two remaining sources are to work it backwards from the c/h/s offsets of individual partitions (v.s. the LBA offsets which Linux uses), or to "use SG_IO to issue an IDENTIFY to any ATA or CFA drive to see how it has mapped the device.", i.e. hdparm -I. groups.google.com/forum/#!msg/linux.kernel/ehSVo9qL9fk/… – sourcejedi Mar 30 '17 at 19:09
  • 1
    Oops, I guess working the values backwards from the partitions, does count as those values coming from the partition table. But not in a nice way. I admit I don't understand why sfdisk fails to find a consistent c/h/s geometry, I just don't think it's worth worrying about. – sourcejedi Mar 30 '17 at 19:27
2

Tests according to comments

I have tested the USB adapter with a backup SD card on the Raspberrry and saw the same warning:

raspberrypi:~$ sudo sfdisk -lV /dev/sdb

Disk /dev/sdb: 1015 cylinders, 32 heads, 62 sectors/track
sfdisk: Warning: The partition table looks like it was made
  for C/H/S=*/113/51 (instead of 1015/32/62).
For this listing I'll assume that geometry.
Units: cylinders of 2950656 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1   *      2+    349-    347-    999552    7  HPFS/NTFS/exFAT
                start: (c,h,s) expected (2,90,13) found (1,1,1)
                end: (c,h,s) expected (349,77,18) found (125,112,51)
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
sfdisk: Warning: partition 1 does not start at a cylinder boundary
sfdisk: Warning: partition 1 does not end at a cylinder boundary
sfdisk: partition 1: start: (c,h,s) expected (8,4,9) found (1,1,1)
sfdisk: end of partition 1 has impossible value for head: 112 (should be in 0-31)

Another USB stick with a single vfat partition showed

Disk /dev/sdb: 1015 cylinders, 32 heads, 62 sectors/track
sfdisk: Warning: The partition table looks like it was made
  for C/H/S=*/113/51 (instead of 1015/32/62).
For this listing I'll assume that geometry.
Units: cylinders of 2950656 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1   *      2+    349-    347-    999552    7  HPFS/NTFS/exFAT
                start: (c,h,s) expected (2,90,13) found (1,1,1)
                end: (c,h,s) expected (349,77,18) found (125,112,51)
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
sfdisk: Warning: partition 1 does not start at a cylinder boundary
sfdisk: Warning: partition 1 does not end at a cylinder boundary
sfdisk: partition 1: start: (c,h,s) expected (8,4,9) found (1,1,1)
sfdisk: end of partition 1 has impossible value for head: 112 (should be in 0-31)

I also tested two other simple USB card readers (unfortunately all without SDHC and SDXC support) and they all showed the same result.

I am wondering what other people see for

sudo sfdisk -lV /dev/mmcblk0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.