microSD Disk Size capacirty

Hi, I booted off of a 2 GB microSD which has been programmed with Robert Nelson’s ubuntu BBB flasher image (13.04, 06-14). df shows 91 % of root partition is is being used.

root@arm:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 602M 514M 57M 91% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 247M 12K 247M 1% /dev
tmpfs 50M 252K 50M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 248M 0 248M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/mmcblk0p1 71M 19M 52M 27% /boot/uboot ← eMMC

fdisk -l reports the total size to be close to 2 gig:

root@arm:~# fdisk -l

Disk /dev/mmcblk0: 1966 MB, 1966080000 bytes
255 heads, 63 sectors/track, 239 cylinders, total 3840000 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
Disk identifier: 0x0001c92d

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 63 144584 72261 b W95 FAT32
/dev/mmcblk0p2 144585 1429784 642600 83 Linux

Disk /dev/mmcblk1: 1920 MB, 1920991232 bytes
4 heads, 16 sectors/track, 58624 cylinders, total 3751936 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
Disk identifier: 0x000f0a50

Device Boot Start End Blocks Id System
/dev/mmcblk1p1 * 2048 133119 65536 e W95 FAT16 (LBA)
/dev/mmcblk1p2 133120 3751935 1809408 83 Linux

Disk /dev/mmcblk1boot1: 1 MB, 1048576 bytes
4 heads, 16 sectors/track, 32 cylinders, total 2048 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
Disk identifier: 0x00000000

Disk /dev/mmcblk1boot1 doesn’t contain a valid partition table

Disk /dev/mmcblk1boot0: 1 MB, 1048576 bytes
4 heads, 16 sectors/track, 32 cylinders, total 2048 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
Disk identifier: 0x00000000

Disk /dev/mmcblk1boot0 doesn’t contain a valid partition table

Is this because default partition sizes are intentionally kept small ? I would like to know if the partition sizes could be changed to utilize all the space before burning the image or even after. I am using a Windows tool called Win32DiskImager.

It was intentionally kept just big enough for the root file system,
such that you could easily use a 1/2/4Gb microSD card when flashing
the eMMC.

Once the image is transferred to the eMMC, it'll fully utilize the
full 2Gb of space available on the eMMC..

Regards,

Thanks Robert for the quick reply. I wanted to do some customization booting
off the SD card, following these steps:

1. boot BeagleBoard off the SD card
2. Add packages, customize etc
3. Take the SD card out and make an image using an imaging tool
4. use this image to burn back a fresh new SD card and flash the eMMC so
that the customizations are applied without manual intervention each time.

Right now I am stuck at 2 cause it I need to modify the partition size (it
runs out of space). Any idea what I can do to achieve this?

Right now... Your stuck with using the 'full image'...

http://elinux.org/BeagleBoardUbuntu#Demo_Image

The one where you need linux to burn the microSD card... But hey, once
you flash one BBB's eMMC, you now have a full linux system, which you
could use to flash other microSD cards... (Just make sure the microSD
card is blank and inserted before you power on the system, otherwise
it's not detected....)

Once your happy with the microSD cards as.. Just add a blank file
"flash-eMMC.txt" to the boot partition

sudo touch /boot/uboot/flash-eMMC.txt

And the startup scripts created with my image will do the rest...

Regards,

>
> Thanks Robert for the quick reply. I wanted to do some customization
booting
> off the SD card, following these steps:
>
> 1. boot BeagleBoard off the SD card
> 2. Add packages, customize etc
> 3. Take the SD card out and make an image using an imaging tool
> 4. use this image to burn back a fresh new SD card and flash the eMMC so
> that the customizations are applied without manual intervention each
time.
>
> Right now I am stuck at 2 cause it I need to modify the partition size
(it
> runs out of space). Any idea what I can do to achieve this?

Right now... Your stuck with using the 'full image'...

BeagleBoardUbuntu - eLinux.org

The one where you need linux to burn the microSD card... But hey, once
you flash one BBB's eMMC, you now have a full linux system, which you
could use to flash other microSD cards... (Just make sure the microSD
card is blank and inserted before you power on the system, otherwise
it's not detected....)

Once your happy with the microSD cards as.. Just add a blank file
"flash-eMMC.txt" to the boot partition

sudo touch /boot/uboot/flash-eMMC.txt

And the startup scripts created with my image will do the rest...

Regards,

--
Robert Nelson

http://www.rcn-ee.com/

Cool so I saw the microSD --> eMMC with /boot/uboot/flash-eMMC.txt and
all the rsync in action. But how do I do the other, when you said:

"once you flash one BBB's eMMC, you now have a full linux system, which you
could use to flash other microSD cards... (Just make sure the microSD
card is blank and inserted before you power on the system, otherwise
it's not detected....) "

Is there another script to backup contents of eMMC to microSD ?

Thanks

Ratin

I was working on one, just never finished it as other things came up.
So here is something, very quick... dd

sudo dd if=/dev/mmcblk1 of=/dev/mmcblk0

Regards,

Found this - but not sure if this will work for Ubuntu … seems to be for Angstrom

https://github.com/beagleboard/meta-beagleboard/blob/master/contrib/bone-flash-tool/emmc-prepare.sh

I will try dd, but I guess I have to first zero out unused spaces with “dd if=/dev/zero of=/0bits bs=20”

Okay, just pushed a new script out:
https://github.com/RobertCNelson/tools/blob/master/scripts/beaglebone-black-copy-eMMC-to-microSD.sh

After unifying everything in the older one, the only difference
between the two scripts is, source & destination are reversed...
Still need to do a quick error check that the 'mmc' device actually
exists... but other wise it works..

Regards,

For some reason it had an “error write failed” , and would not let me login (during the time it was trying to do the copy to eMMC) so I couldnt tell if it succeeded or not. I will do some more digging.

Hi Robert, I am not having much luck with this … I get the BLKRRPART: Device or resource busy error and “ERROR: sector 3069841408 does not have an msdos signature”. Second time around, I did “dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=1” as it suggested but no luck (2nd round). I then took out the SD card and reformatted as FAT32 with gparted, but still no luck (3rd run below), its hung. Wonder why it says resource is busy. I did have a tempfs mounted :

tmpfs on /tmp/tmpfs type tmpfs (rw,size=3m)

and I ran the script from inside /tmp but I dont think that matters …

root@arm:/tmp# ls
beaglebone-black-copy-eMMC-to-microSD.sh tmpfs
root@arm:/tmp# ./beaglebone-black-copy-eMMC-to-microSD.sh
update-initramfs: Generating /boot/initrd.img-3.8.13-bone21
grep: /boot/config-3.8.13-bone21: No such file or directory
‘/boot/initrd.img-3.8.13-bone21’ → ‘/boot/uboot/initrd.img’
Image Name: initramfs
Created: Sun Jun 30 02:54:14 2013
Image Type: ARM Linux RAMDisk Image (uncompressed)
Data Size: 2709751 Bytes = 2646.24 kB = 2.58 MB
Load Address: 00000000
Entry Point: 00000000
umount: /dev/mmcblk0p1: not mounted
umount: /dev/mmcblk0p2: not mounted
16+0 records in
16+0 records out
16777216 bytes (17 MB) copied, 0.142181 s, 118 MB/s
Checking that no-one is using this disk right now …
BLKRRPART: Device or resource busy

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/mmcblk0: 60000 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 3069370368 does not have an msdos signature
/dev/mmcblk0: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 * 0+ 70- 71- 72261 e W95 FAT16 (LBA)
/dev/mmcblk0p2 70+ 1874- 1805- 1847475 83 Linux
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
Successfully wrote the new partition table

Re-reading the partition table …
BLKRRPART: Device or resource busy
The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
root@arm:/tmp# ^C

root@arm:/tmp# dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00515201 s, 99.4 kB/s
root@arm:/tmp#
root@arm:/tmp#
root@arm:/tmp# ./beaglebone-black-copy-eMMC-to-microSD.sh
update-initramfs: Generating /boot/initrd.img-3.8.13-bone21
grep: /boot/config-3.8.13-bone21: No such file or directory
‘/boot/initrd.img-3.8.13-bone21’ → ‘/boot/uboot/initrd.img’
Image Name: initramfs
Created: Sun Jun 30 03:00:43 2013
Image Type: ARM Linux RAMDisk Image (uncompressed)
Data Size: 2709750 Bytes = 2646.24 kB = 2.58 MB
Load Address: 00000000
Entry Point: 00000000
umount: /dev/mmcblk0p1: not mounted
umount: /dev/mmcblk0p2: not mounted
16+0 records in
16+0 records out
16777216 bytes (17 MB) copied, 0.0885991 s, 189 MB/s
Checking that no-one is using this disk right now …
BLKRRPART: Device or resource busy

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/mmcblk0: 60000 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 3069546496 does not have an msdos signature
/dev/mmcblk0: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 * 0+ 70- 71- 72261 e W95 FAT16 (LBA)
/dev/mmcblk0p2 70+ 1874- 1805- 1847475 83 Linux
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
Successfully wrote the new partition table

Re-reading the partition table …
BLKRRPART: Device or resource busy
The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
root@arm:/tmp# nano ./beaglebone-black-copy-eMMC-to-microSD.sh
root@arm:/tmp# ./beaglebone-black-copy-eMMC-to-microSD.sh

  • source=/dev/mmcblk1
  • destination=/dev/mmcblk0
  • check_running_system
  • ‘[’ ‘!’ -f /boot/uboot/uEnv.txt ‘]’
  • check_host_pkgs
  • unset deb_pkgs
  • dpkg -l
  • grep dosfstools
  • grep rsync
  • dpkg -l
  • grep u-boot-tools
  • dpkg -l
  • ‘[’ ‘’ ‘]’
  • update_boot_files
    ++ uname -r
  • ‘[’ ‘!’ -f /boot/initrd.img-3.8.13-bone21 ‘]’
    ++ uname -r
  • update-initramfs -u -k 3.8.13-bone21
    update-initramfs: Generating /boot/initrd.img-3.8.13-bone21
    grep: /boot/config-3.8.13-bone21: No such file or directory
    ++ uname -r
  • ‘[’ -f /boot/vmlinuz-3.8.13-bone21 ‘]’
    ++ uname -r
  • ‘[’ -f /boot/initrd.img-3.8.13-bone21 ‘]’
    ++ uname -r
  • cp -v /boot/initrd.img-3.8.13-bone21 /boot/uboot/initrd.img
    ‘/boot/initrd.img-3.8.13-bone21’ → ‘/boot/uboot/initrd.img’
    ++ uname -r
  • mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-3.8.13-bone21 /boot/uboot/uInitrd
    Image Name: initramfs
    Created: Sun Jun 30 03:02:45 2013
    Image Type: ARM Linux RAMDisk Image (uncompressed)
    Data Size: 2709760 Bytes = 2646.25 kB = 2.58 MB
    Load Address: 00000000
    Entry Point: 00000000
  • mount_n_check
  • umount /dev/mmcblk0p1
    umount: /dev/mmcblk0p1: not mounted
  • true
  • umount /dev/mmcblk0p2
    umount: /dev/mmcblk0p2: not mounted
  • true
  • lsblk
  • grep /dev/mmcblk0p1
  • repartition_emmc
  • dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=16
    16+0 records in
    16+0 records out
    16777216 bytes (17 MB) copied, 0.143162 s, 117 MB/s
  • LC_ALL=C
  • sfdisk --force --DOS --sectors 63 --heads 255 --unit M /dev/mmcblk0
    Checking that no-one is using this disk right now …
    BLKRRPART: Device or resource busy

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/mmcblk0: 60000 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 3069841408 does not have an msdos signature
/dev/mmcblk0: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 * 0+ 70- 71- 72261 e W95 FAT16 (LBA)
/dev/mmcblk0p2 70+ 1874- 1805- 1847475 83 Linux
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
Successfully wrote the new partition table

Re-reading the partition table …
BLKRRPART: Device or resource busy
The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

root@arm:/tmp# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk1boot0 179:16 0 1M 1 disk
mmcblk1boot1 179:24 0 1M 1 disk
mmcblk0 179:0 0 1.9G 0 disk

-mmcblk0p1 179:1 0 70.6M 0 part
-mmcblk0p2 179:2 0 627.6M 0 part mmcblk1 179:8 0 1.8G 0 disk -mmcblk1p1 179:9 0 64M 0 part /boot/uboot -mmcblk1p2 179:10 0 1.7G 0 part /
root@arm:/tmp# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk1boot0 179:16 0 1M 1 disk
mmcblk1boot1 179:24 0 1M 1 disk
mmcblk0 179:0 0 1.9G 0 disk
-mmcblk0p1 179:1 0 70.6M 0 part
-mmcblk0p2 179:2 0 627.6M 0 part mmcblk1 179:8 0 1.8G 0 disk -mmcblk1p1 179:9 0 64M 0 part /boot/uboot -mmcblk1p2 179:10 0 1.7G 0 part /
root@arm:/tmp#
root@arm:/tmp#
root@arm:/tmp# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk1boot0 179:16 0 1M 1 disk
mmcblk1boot1 179:24 0 1M 1 disk
mmcblk0 179:0 0 1.9G 0 disk
-mmcblk0p1 179:1 0 70.6M 0 part
-mmcblk0p2 179:2 0 627.6M 0 part mmcblk1 179:8 0 1.8G 0 disk -mmcblk1p1 179:9 0 64M 0 part /boot/uboot -mmcblk1p2 179:10 0 1.7G 0 part /
root@arm:/tmp# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk1boot0 179:16 0 1M 1 disk
mmcblk1boot1 179:24 0 1M 1 disk
mmcblk0 179:0 0 1.9G 0 disk
-mmcblk0p1 179:1 0 70.6M 0 part
-mmcblk0p2 179:2 0 627.6M 0 part mmcblk1 179:8 0 1.8G 0 disk -mmcblk1p1 179:9 0 64M 0 part /boot/uboot -mmcblk1p2 179:10 0 1.7G 0 part /
root@arm:/tmp#
root@arm:/tmp#
root@arm:/tmp#
root@arm:/tmp#

root@arm:/tmp# ls /dev/mmcblk*
mmcblk0 mmcblk0p1 mmcblk0p2 mmcblk1 mmcblk1boot0 mmcblk1boot1 mmcblk1p1 mmcblk1p2
root@arm:/tmp# ./beaglebone-black-copy-eMMC-to-microSD.sh

  • source=/dev/mmcblk1
  • destination=/dev/mmcblk0
  • check_running_system
  • ‘[’ ‘!’ -f /boot/uboot/uEnv.txt ‘]’
  • check_host_pkgs
  • unset deb_pkgs
  • dpkg -l
  • grep dosfstools
  • grep rsync
  • dpkg -l
  • grep u-boot-tools
  • dpkg -l
  • ‘[’ ‘’ ‘]’
  • update_boot_files
    ++ uname -r
  • ‘[’ ‘!’ -f /boot/initrd.img-3.8.13-bone21 ‘]’
    ++ uname -r
  • update-initramfs -u -k 3.8.13-bone21
    update-initramfs: Generating /boot/initrd.img-3.8.13-bone21
    grep: /boot/config-3.8.13-bone21: No such file or directory
    ++ uname -r
  • ‘[’ -f /boot/vmlinuz-3.8.13-bone21 ‘]’
    ++ uname -r
  • ‘[’ -f /boot/initrd.img-3.8.13-bone21 ‘]’
    ++ uname -r
  • cp -v /boot/initrd.img-3.8.13-bone21 /boot/uboot/initrd.img
    ‘/boot/initrd.img-3.8.13-bone21’ → ‘/boot/uboot/initrd.img’
    ++ uname -r
  • mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-3.8.13-bone21 /boot/uboot/uInitrd
    Image Name: initramfs
    Created: Sun Jun 30 03:09:51 2013
    Image Type: ARM Linux RAMDisk Image (uncompressed)
    Data Size: 2709744 Bytes = 2646.23 kB = 2.58 MB
    Load Address: 00000000
    Entry Point: 00000000
  • mount_n_check
  • umount /dev/mmcblk0p1
    umount: /dev/mmcblk0p1: not mounted
  • true
  • umount /dev/mmcblk0p2
    umount: /dev/mmcblk0p2: not mounted
  • true
  • grep /dev/mmcblk0p1
  • lsblk
  • repartition_emmc
  • dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=16
    16+0 records in
    16+0 records out
    16777216 bytes (17 MB) copied, 0.0803752 s, 209 MB/s
  • LC_ALL=C
  • sfdisk --force --DOS --sectors 63 --heads 255 --unit M /dev/mmcblk0
    Checking that no-one is using this disk right now …
    BLKRRPART: Device or resource busy

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/mmcblk0: 60000 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 3069308928 does not have an msdos signature
/dev/mmcblk0: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 * 0+ 70- 71- 72261 e W95 FAT16 (LBA)
/dev/mmcblk0p2 70+ 1874- 1805- 1847475 83 Linux
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty

Hi Robert, I am not having much luck with this … I get the BLKRRPART: Device or resource busy error and “ERROR: sector 3069841408 does not have an msdos signature”. Second time around, I did “dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=1” as it suggested but no luck (2nd round). I then took out the SD card and reformatted as FAT32 with gparted, but still no luck (3rd run below), its hung. Wonder why it says resource is busy. I did have a tempfs mounted :

tmpfs on /tmp/tmpfs type tmpfs (rw,size=3m)
and I ran the script from inside /tmp but I dont think that matters …

Umm the script is only setup to copy from the running partition to the other. If you start doing fancy mounts… Well patches welcome…

try following command

sudo ./setup_sdcard.sh --mmc /dev/sdX --uboot bone_dtb

I was also getting same error, when I tried -

No you weren't.. Totally different script/subject.

Regards,

Sorry,
The reply was to ‘Crazy Monster’ for the error - 'BLKRRPART: Device or resource busy error ’

Thanks for the reply but I have since moved to cubieboard2 for the choice of product because it has dual cortex and some more ram.