Multipartition for SD-card not working, am I using the right guide?

Moderator: nferre

daanschilder
Posts: 1
Joined: Fri Aug 31, 2018 4:00 pm

Multipartition for SD-card not working, am I using the right guide?

Fri Aug 31, 2018 4:13 pm

Hi,

I've just started with the ATSAMA5D27-SOM1-EK1, where I am making use of the guide available at : https://www.digikey.com/eewiki/display/ ... -SOM1-EK1

I am able to build all images / binaries using the buildroot, but am stuck at the chapter 'Setup microSD card':
My SD Card reader is an USB reader (Something build in my Dell PC) which shows up (lsusb) as:
Bus 001 Device 004: ID 058f:6366 Alcor Micro Corp. Multi Flash Reader

using the commands sg_scan and sg_map i've found out it is located as /dev/sdb1 (checked it with a mount).

export DISK=/dev/sdb1

sudo dd if=/dev/zero of=${DISK} bs=1M count=50 works out fine,
sudo sfdisk --version returns sfdisk from util-linux 2.27.1

sudo sfdisk ${DISK} <<-__EOF__
1M,48M,0xE,*
49M,,,-
__EOF__


returns
Checking that no-one is using this disk right now ... FAILED

This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.

sfdisk: Use the --force flag to overrule all checks.


forcing the sfdisk with -f returns:

Checking that no-one is using this disk right now ... FAILED

This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.

sfdisk: Use the --force flag to overrule all checks:

Checking that no-one is using this disk right now ... FAILED

This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.

Disk /dev/sdb1: 7.5 GiB, 8086618112 bytes, 15794176 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

>>> Created a new DOS disklabel with disk identifier 0xed891127.
Created a new partition 1 of type 'W95 FAT16 (LBA)' and of size 48 MiB.
/dev/sdb1p2: Created a new partition 2 of type 'Linux' and of size 7.5 GiB.
/dev/sdb1p3:
New situation:

Device Boot Start End Sectors Size Id Type
/dev/sdb1p1 * 2048 100351 98304 48M e W95 FAT16 (LBA)
/dev/sdb1p2 100352 15794175 15693824 7.5G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Syncing disks.


However, after rebooting, the /dev/sdb1p1 and /dev/sdb1p2 do not show up (which is required for the next step).

Anyone familiar with this behaviour?

Regards,

Daan
blue_z
Location: USA
Posts: 1716
Joined: Thu Apr 19, 2007 10:15 pm

Re: Multipartition for SD-card not working, am I using the right guide?

Fri Aug 31, 2018 11:53 pm

daanschilder wrote:am I using the right guide?
Yes, but you're not following it correctly. Hence the problems you're encountering.

You need to properly distinguish between the disk drive and its partitions.
(Since SDcards emulate a disk drive, they are treated in the same manner.)
Your SDcard reader presents the inserted card as a SCSI disk with the name /dev/sdb.

That follows the convention of using the device name sd with an alpha character to refer to the entire physical drive (or card).

The naming convention for disk partitions is to append a number to the name of the drive, e.g. /dev/sdb1 for the first partition.

daanschilder wrote:...i've found out it is located as /dev/sdb1 (checked it with a mount).
What is this "it" that you refer to?

You mount a filesystem and specify the name of the disk partition.
So this "it" is the name of a partition, and not the name of a disk.

Therefore your assignment is incorrect:
daanschilder wrote: export DISK=/dev/sdb1
Instead of wiping and partitioning a disk, you're trying to perform these operations on a disk partition, which is nonsensical.


Whereas the guide you linked does provide the correct example to follow:

Code: Select all

Format Partition:
  for: DISK=/dev/mmcblk0
    sudo mkfs.vfat -F 16 -n BOOT ${DISK}p1
    sudo mkfs.ext4 -L rootfs ${DISK}p2
  
  for: DISK=/dev/sdX
    sudo mkfs.vfat -F 16 -n BOOT ${DISK}1
    sudo mkfs.ext4 -L rootfs ${DISK}2
daanschilder wrote:sudo dd if=/dev/zero of=${DISK} bs=1M count=50 works out fine,
No, this did not "work(s) out fine".
This did not perform what needed to be done.
Just because no errors were reported does not mean that you have accomplished the desired goal, i.e. remove the MBR and existing partition table.

daanschilder wrote:However, after rebooting, the /dev/sdb1p1 and /dev/sdb1p2 do not show up (which is required for the next step).
Study that guide (and the SCSI disk naming conventions) more carefully.
Depending on the hardware interface, the device name for a SDcard could be of the form /dev/mmcblkN or /dev/sdX.
And each interface has its own convention for specifying the partition number (because the N is numeric whereas X is alphabetic).

Try using the GUI tool GParted to provide a graphical presentation.


Regards

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 2 guests