0

I am trying to partition my 2GB emmc using sgdisk to have a GPT partion table. The commands show success and also the GPT partition table looks updated (even on reboot) but the partitions are not created at all. Means when I check using ls /dev/mmcblk0 it does not show the partitions I crated. and the my sgdisk always try to create the partitions on p1 but no p2,p3,.... are shown.

Below are the commands I am using and sgdisk -p shows the partitions I created but there is no partitions created /dev/mmcblk0 (p1, p2, p3). Also in the logs you can see it always try to create p1 which was supposed to be p2 and p3 for later partitions. Can you please help using sgdisk for creating the partitions in emmc...

# sgdisk -og /dev/mmcblk0
mmcblk0: p1
The operation has completed successfully.
# sgdisk -p /dev/mmcblk0
Disk /dev/mmcblk0: 3751936 sectors, 1.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 27F5FD73-8C2A-4448-91F6-251B72C64843
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3751902
Partitions will be aligned on 2048-sector boundaries
Total free space is 3751869 sectors (1.8 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name

# sgdisk -n 1:2048:264191 -c 1:"kernel" /dev/mmcblk0
Setting name!
partNum is 0
REALLY setting name!
mmcblk0: p1
The operation has completed successfully.

# sgdisk -n 2:264192:395263 -c 2:"rootfs" /dev/mmcblk0
Setting name!
partNum is 1
REALLY setting name!
mmcblk0: p1
The operation has completed successfully.

# sgdisk -n 3:395263:460799 -c 3:"data" /dev/mmcblk0
Information: Moved requested sector from 395263 to 395264 in
order to align on 2048-sector boundaries.
Setting name!
partNum is 2
REALLY setting name!
mmcblk0: p1
The operation has completed successfully.

# sgdisk -p /dev/mmcblk0
Disk /dev/mmcblk0: 3751936 sectors, 1.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 27F5FD73-8C2A-4448-91F6-251B72C64843
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3751902
Partitions will be aligned on 2048-sector boundaries
Total free space is 3293117 sectors (1.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
  1            2048          264191   128.0 MiB   8300  kernel
  2          264192          395263   64.0 MiB    8300  rootfs
  3          395264          460799   32.0 MiB    8300  data

# ls /dev/mmcblk0
mmcblk0       mmcblk0boot0  mmcblk0boot1  mmcblk0p1

# cat /proc/partitions
major minor  #blocks  name

179        0    1875968 mmcblk0
179        1    1875967 mmcblk0p1
179       16       1024 mmcblk0boot1
179        8       1024 mmcblk0boot0

No logical partitions created.
3
  • 1
    Can you show the output of the commands you tried?
    – Mokubai
    Jun 25, 2015 at 18:11
  • Mokubai: I updated the question with output
    – Reddy
    Jun 25, 2015 at 20:26
  • @RodSmith This is right up your alley Jun 25, 2015 at 21:00

1 Answer 1

1

Need to enable CONFIG_EFI_PARTITION in linux kernel config.

make linux-menuconfig Enable the block layer –> Partition Types -> Select “EFI GUID Partition Support”

With this I am able to see partitions created are written to disk...

Also there is another setting need to be looked, if you are in plan of creating more than 8 partitions.

│ Symbol: MMC_BLOCK_MINORS [=8]
│ Type : integer │
Range : [4 256]
│ Prompt: Number of minors per block device │
│ Defined at drivers/mmc/card/Kconfig:17 │
│ Depends on: MMC [=y] && MMC_BLOCK [=y] │
│ Location: │
│ -> Device Drivers │
│ -> MMC/SD/SDIO card support (MMC [=y]) │
│ -> MMC block device driver (MMC_BLOCK [=y])

Changing the value will support upto 256 partitions...

5
  • This is a good reminder for those who compile their own kernels! IIRC, GPT support is not enabled in the default settings, so checking it is necessary when you compile your own kernel. Most people use pre-compiled kernels from distributions like Ubuntu or Fedora, and these always have GPT support enabled, so this detail is often not mentioned in user documentation.
    – Rod Smith
    Jun 26, 2015 at 14:22
  • @RodSmith You are right. I did not find this piece of information anywhere and strangely there is no error shown anywhere about the missing support and the sgdisk shows the GPT table with the updated partition info.
    – Reddy
    Jun 26, 2015 at 16:21
  • GPT fdisk reads and writes the sectors on the disk directly; it doesn't rely on the kernel to interpret the data, which is why sgdisk shows the partitions as existing -- they do exist, even though the kernel can't read them. The need for the kernel support is mentioned in the GPT fdisk documentation, although not prominently, on the Booting from GPT page. (Search for "EFI GUID" to find it.)
    – Rod Smith
    Jun 26, 2015 at 16:44
  • Thanks RodSmith. My problem is not completely solved. with the above kernel configuration support I am able to create partitions but only 7 partitions (after that GPT table shows it has correct entry for all (10) but they are not created. Do you have any clue on this?. If needed I can create new question on that... FYI: I am trying it on 2GB emmc
    – Reddy
    Jun 26, 2015 at 21:03
  • Very old kernels had limits on the number of partitions you could create per disk. These limits were related to device node major and minor numbers. It could be you're running into this ancient problem because of another kernel option you've overlooked, or possibly some missing or mis-configured userspace utility (IIRC, udev plays a role in this). Quite honestly, it's been so long since I've had to deal with this that I don't recall the details, but searching along these lines might be productive.
    – Rod Smith
    Jun 27, 2015 at 0:26

You must log in to answer this question.

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