Add new comment

Odroid XU4 Linux Booting From Micro-SD or eMMC Cards

Odroid Board

################################################################
##
## Odroid XU4 Linux Booting From Micro-SD or eMMC Cards.
## © Daniel Peess <cookbooks@peess.de>, 2015.
##
################################################################

## NOTE: i did not manage to prep a eMMC properly to boot from it.
## so we will use the Micro-SD card to boot, and the eMMC cards to host our OSDs.

## WARNING: you require both an eMMC Card + a MicroSD Card (temporary for recovery).
## To modify the eMMC Card on your laptop you require an additional MicroSD USB Adapter.

.

.

#################################################
## Shipment

## This is produced in South Korea
## http://www.hardkernel.com/main/main.php
## http://www.hardkernel.com/main/products/prdt_info.php?g_code=G143452239825

## This is imported into Germany by Bavarian Company Pollin.de
## http://www.pollin.de/shop/dt/MDk1OTgxOTk-/Bausaetze_Module/Entwicklerboards/ODROID_XU4_Einplatinen_Computer_SAMSUNG_Exynos_5422_2_GB_2x_USB_3_0.html


#################################################
## References

## http://odroid.com/dokuwiki/doku.php?id=en:odroid
## http://odroid.com/dokuwiki/doku.php?id=en:odroid-xu4

## Did not exist yet at the time of writing:
## http://dev.odroid.com/projects/uboot/wiki/
## http://dev.odroid.com/projects/linux/wiki/
## http://dev.odroid.com/projects/android/wiki/

## eMMC Cards Color Table:
## http://odroid.com/dokuwiki/doku.php?id=en:emmc_reference_chart

## "How to: Odroid XU3/XU4 MultiBoot"
## "EMMC INITIALIZATION"
## http://forum.odroid.com/viewtopic.php?f=95&t=15403

## The boot loader for Odroid XU3 + XU4 are on special hidden partitions on the eMMC card.
## http://codewalkerster.blogspot.de/2015/07/how-to-write-images-without-fastboot-on.html
## http://codewalkerster.blogspot.de/2015/07/how-to-recovery-emmc-for-odroid-xu34.html
## http://codewalkerster.blogspot.kr/2015/07/adb-connect-over-tcpip-when-multiple.html
## http://codewalkerster.blogspot.de/2015/07/how-to-recovery-emmc-for-odroid-xu34.html

## XU3/4 eMMC Bootloader Recovery
## Use micro-sdcard recovery image to create proper eMMC boot loader:
## http://odroid.com/dokuwiki/doku.php?id=en:emmc_recovery_xu4
## http://odroid.com/dokuwiki/doku.php?id=en:emmc_recovery_xu3

## "... with the new XU4, you must use mdrjr's latest alpha 2.4 file. The older versions were ineffective. "
## http://forum.odroid.com/viewtopic.php?f=53&t=6173
## http://dn.odroid.com/5422/ODROID-XU3/Android/
## http://dn.odroid.com/5422/ODROID-XU3/Android/4.4.4_Alpha_2.4_Jul-20-2015/
## http://dn.odroid.com/5422/ODROID-XU3/Android/4.4.4_Alpha_2.4_Jul-20-2015/android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip
## http://dn.odroid.com/5422/ODROID-XU3/Android/4.4.4_Alpha_2.4_Jul-20-2015/android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip.md5sum

## wheezy-7-server-odroidxu4-20150802.img.xz
## ubuntu-14.04lts-server-odroidxu4-20150802.img.xz
## http://dn.odroid.com/5422/ODROID-XU4/release/


#################################################
## Create XU4 eMMC Bootloader within Hidden Partitions via MicroSD Card Recovery Image.

## WARNING
## "Many SD-to-MicroSD adapter don't work correctly. You need to connect the flash storage to your USB reader directly."
## http://odroid.com/dokuwiki/doku.php?id=en:odroid_flashing_tools
## I had to ignore this, as i do not possess any microsd-usb-adapter.
## I made sure however that the microsd-sdcard adapter is recent and supports the SDXC/UHS-1 standard.

$ ls -ltr /dev/disk/by-id/mmc*;
lrwxrwxrwx. 1 root root 13 Aug 13 16:10 mmc-SU64G_0x101ffb35 -> ../../mmcblk0
lrwxrwxrwx. 1 root root 15 Aug 13 16:10 mmc-SU64G_0x101ffb35-part1 -> ../../mmcblk0p1

## the micro-sdcard has to be at least 8 GiB, 64 GiB is wasted if you do not require logs that go far back.
$ blockdev --getsize64 '/dev/disk/by-id/mmc-SU64G_0x101ffb35';
63864569856

## http://dn.odroid.com/5422/ODROID-XU3/Android/4.4.4_Alpha_2.4_Jul-20-2015/android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip
## http://dn.odroid.com/5422/ODROID-XU3/Android/4.4.4_Alpha_2.4_Jul-20-2015/android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip.md5sum

$ ll
total 5014028
-rw-rw-r--. 1 anonymous anonymous  209736088 Aug 11 17:04 android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip
-rw-r--r--. 1 anonymous anonymous        103 Aug 11 17:10 android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip.md5
-rw-rw-r--. 1 anonymous anonymous  174789244 Aug 11 16:41 ubuntu-14.04lts-server-odroidxu4-20150802.img.xz
-rw-r--r--. 1 anonymous anonymous         83 Aug 11 17:10 ubuntu-14.04lts-server-odroidxu4-20150802.img.xz.md5
-rw-rw-r--. 1 anonymous anonymous         76 Aug  1 08:48 ubuntu-15.04-mate-odroid-xu3-20150710.img.md5sum
-rw-rw-r--. 1 anonymous anonymous  883725792 Aug  1 11:17 ubuntu-15.04-mate-odroid-xu3-20150710.img.xz
-rw-rw-r--. 1 anonymous anonymous         79 Aug  1 08:48 ubuntu-15.04-mate-odroid-xu3-20150710.img.xz.md5sum

$ unzip -tv 'android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip';
Archive:  android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip
    testing: android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img   OK
No errors detected in compressed data of android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip.

$ unzip 'android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip';
Archive:  android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img.zip
  inflating: android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img 

$ file 'android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img';
android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img: DOS/MBR boot sector; partition 1 : ID=0xb, start-CHS (0xc,190,51), end-CHS (0x3f,188,61), startsector 204800, 819200 sectors

## man dd: BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000,
## M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

$ sleep 4 && dd if='android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img' of='/dev/disk/by-id/mmc-SU64G_0x101ffb35' bs='1M';
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 12.2071 s, 42.9 MB/s

$ partprobe '/dev/disk/by-id/mmc-SU64G_0x101ffb35';
Error: Partition(s) 1 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.

$ blkid '/dev/disk/by-id/mmc-SU64G_0x101ffb35';
/dev/disk/by-id/mmc-SU64G_0x101ffb35: PTUUID="000d580f" PTTYPE="dos"

$ wipefs '/dev/disk/by-id/mmc-SU64G_0x101ffb35';
offset               type
----------------------------------------------------------------
0x1fe                dos   [partition table]

$ wipefs '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part1';
offset               type
----------------------------------------------------------------
0x52                 vfat   [filesystem]
                     UUID:  1D8D-2A15

$ ls -las '/run/media/anonymous/1D8D-2A15'/;
total 399124
     4 drwxr-xr-x. 2 anonymous anonymous      4096 Jan  1  1970 .
     0 drwxr-x---+ 3 root      root             60 Aug 13 16:14 ..
    16 -rw-r--r--. 1 anonymous anonymous     15360 Jul 20 18:25 bl1.bin
    16 -rw-r--r--. 1 anonymous anonymous     14592 Jul 20 18:25 bl2.bin
     4 -rw-r--r--. 1 anonymous anonymous      3640 Jul 20 18:37 boot.ini
  6204 -rw-r--r--. 1 anonymous anonymous   6348948 Jul 20 18:25 cache.img
   388 -rw-r--r--. 1 anonymous anonymous    393966 Jul 20 18:25 ramdisk.img
346836 -rw-r--r--. 1 anonymous anonymous 355159872 Jul 20 18:25 system.img
   256 -rw-r--r--. 1 anonymous anonymous    262144 Jul 20 18:25 tzsw.bin
   272 -rw-r--r--. 1 anonymous anonymous    275684 Jul 20 18:25 u-boot.bin
35984 -rw-r--r--. 1 anonymous anonymous  36844316 Jul 20 18:25 userdata.img
  4572 -rw-r--r--. 1 anonymous anonymous   4680958 Jul 20 18:25 zImage
  4572 -rw-r--r--. 1 anonymous anonymous   4680958 Jul 20 18:25 zImage-dtb

$ umount '/run/media/anonymous/1D8D-2A15/';

## 1) stick your empty eMMC card to the odroid pcb on the bottom side.
## 2) stick the micro-sdcard into the odroid-xu4 sdcard slot.
## 3) plug in 5V/4A power.
## 4) wait 10 seconds for the red light to switch to blue.
## 5) wait for the recovery image on the sdcard to boot,
## 6) it automatically writes the boot loader to the hidden sectors on the eMMC card.
## 7) wait for it to automatically turn off again.
## 8) unplug the power supply.
## 9) use the microsd eMMC reader to attach the eMMC card to your laptop.

$ ls -ltr /dev/disk/by-id/mmc*;
lrwxrwxrwx. 1 root root 13 Aug 13 16:33 /dev/disk/by-id/mmc-064GE2_0xde70c8b3 -> ../../mmcblk0
lrwxrwxrwx. 1 root root 15 Aug 13 16:33 /dev/disk/by-id/mmc-064GE2_0xde70c8b3-part2 -> ../../mmcblk0p2
lrwxrwxrwx. 1 root root 15 Aug 13 16:33 /dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1 -> ../../mmcblk0p1

$ blkid '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
/dev/disk/by-id/mmc-064GE2_0xde70c8b3: PTUUID="000cde21" PTTYPE="dos"

$ blkid '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1: SEC_TYPE="msdos" LABEL="BOOT" UUID="6E35-5356" TYPE="vfat" PARTUUID="000cde21-01"

$ blkid '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part2';
/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part2: LABEL="trusty" UUID="e139ce78-9841-40fe-8823-96a304a09859" TYPE="ext4" PARTUUID="000cde21-02"


#################################################
## first remove any previous boot image,
## here it was an odroid-c emmc card ubuntu trusty image.

$ ll '/run/media/anonymous/BOOT/';
total 7312
-rw-r--r--. 1 anonymous anonymous    2290 Feb  4  2015 boot.ini
-rw-r--r--. 1 anonymous anonymous   18174 Feb  4  2015 meson8b_odroidc.dtb
-rw-r--r--. 1 anonymous anonymous   36601 Feb  4  2015 meson8b_odroidc.dts
-rw-r--r--. 1 anonymous anonymous 5308810 Feb  4  2015 uImage
-rw-r--r--. 1 anonymous anonymous 2113318 Feb  4  2015 uInitrd

$ ll '/run/media/anonymous/trusty/';
total 92
drwxr-xr-x.   2 root root  4096 Jan 19  2015 bin
drwxr-xr-x.   2 root root  4096 Feb  3  2015 boot
drwxr-xr-x.  14 root root 20480 May 17  2014 dev
drwxr-xr-x. 143 root root 12288 Feb  4  2015 etc
drwxr-xr-x.   3 root root  4096 May 17  2014 home
drwxr-xr-x.  18 root root  4096 Jan 19  2015 lib
drwx------.   2 root root  4096 Jun 11  2014 lost+found
drwxr-xr-x.   4 root root  4096 Aug  7  2014 media
drwxr-xr-x.   2 root root  4096 May 17  2014 mnt
dr-xr-xr-x. 137 root root  4096 Jan  1  1970 proc
drwxr-xr-x.   4 root root  4096 Feb  4  2015 root
drwxr-xr-x.  19 root root  4096 May 17  2014 run
drwxr-xr-x.   2 root root  4096 Jan 19  2015 sbin
dr-xr-xr-x.   2 root root  4096 May 17  2014 sys
drwxr-xr-x.   2 root root  4096 May 17  2014 tmp
drwxr-xr-x.  11 root root  4096 Jun 10  2014 usr
drwxr-xr-x.  13 root root  4096 Jun 11  2014 var

$ umount '/run/media/anonymous/trusty/';
$ umount '/run/media/anonymous/BOOT/';

$ blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0x1bd89870';
62537072640
$ blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
134742016
$ blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2';
4780457984

$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2';
offset               type
----------------------------------------------------------------
0x438                ext4   [filesystem]
                     LABEL: trusty
                     UUID:  e139ce78-9841-40fe-8823-96a304a09859

$ wipefs -o '0x438' '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2';
/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef

$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2';
<EMPTY>

$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
offset               type
----------------------------------------------------------------
0x36                 vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  6E35-5356

$ wipefs -o '0x36' '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1: 8 bytes were erased at offset 0x00000036 (vfat): 46 41 54 31 36 20 20 20
$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
offset               type
----------------------------------------------------------------
0x0                  vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  6E35-5356

$ wipefs -o '0x0' '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1: 1 byte was erased at offset 0x00000000 (vfat): eb
$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
offset               type
----------------------------------------------------------------
0x1fe                vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  6E35-5356

$ wipefs -o '0x1fe' '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa

$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1';
<EMPTY>

$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870';
offset               type
----------------------------------------------------------------
0x1fe                dos   [partition table]

$ wipefs -o '0x1fe' '/dev/disk/by-id/mmc-064GE2_0x1bd89870';
/dev/disk/by-id/mmc-064GE2_0x1bd89870: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/disk/by-id/mmc-064GE2_0x1bd89870: calling ioctl to re-read partition table: Success

$ wipefs '/dev/disk/by-id/mmc-064GE2_0x1bd89870';
<EMPTY>


#################################################
## Write XU4 eMMC Boot Image

## the bootloader on Odroid XU4 is based on 'uboot', not on BIOS+MBR or EFI+GPT as on x86-64.
##
## check this table for the XU3+XU4 boot partition layout on eMMC cards:
## Area Name            Size    From(sector #)  To(Sector #)    Name for Fastboot       Partition Name
## PT (MBR)             512     0               0              
## fwbl1                15KB    1               30              fwbl1  
## bl2                  16KB    31              62              bl2    
## u-boot               328KB   63              718             bootloader     
## TrustZone SW         256KB   719             1230            tzsw   
## u-boot environment   16KB    1231            1262           
## FAT16 boot           129M    3072            266239                                  mmcblk0p1
## EXT4  root         <=64GB    266240          remaining                               mmcblk0p2
##
## http://odroid.com/dokuwiki/doku.php?id=en:xu3_partition_table

## As long there is no native Ubuntu 15.04 ARM image for odroid-xu4 yet:
## http://odroid.com/dokuwiki/doku.php?id=en:xu4_release_debian_mainline
## http://odroid.com/dokuwiki/doku.php?id=en:xu4_building_kernel
## http://odroid.com/dokuwiki/doku.php?id=en:xu3_building_kernel

## I've used the odroid-xu3 image of it instead:
## http://odroid.com/dokuwiki/doku.php?id=en:xu3_release_linux_ubuntu
## http://odroid.com/dokuwiki/doku.php?id=en:xu3_ubuntu_release_note_20150710
## https://github.com/mdrjr/5422_BSP
## Kernel 3.10.82
## Preparations to support XU4

$ xz -l 'ubuntu-15.04-mate-odroid-xu3-20150710.img.xz';
Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename
   22      22    842.8 MiB   4048.0 MiB  0.208  CRC64   ubuntu-15.04-mate-odroid-xu3-20150710.img.xz

$ time xz -t 'ubuntu-15.04-mate-odroid-xu3-20150710.img.xz';

real    0m58.679s
user    0m58.407s
sys     0m0.263s

## Never seen this before, but let us trust this advise:
## "In order to flush all cached data into MicroSD, you MUST do the command sync multiple times. Otherwise data would be corrupted."
## http://odroid.com/dokuwiki/doku.php?id=en:odroid_flashing_tools

$ blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0x1bd89870';
62537072640

## man dd: BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000,
## M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

## This recent XU3 image did not boot for me:
$ date; xzcat 'ubuntu-15.04-mate-odroid-xu3-20150710.img.xz' | dd of='/dev/disk/by-id/mmc-064GE2_0x1bd89870' bs='1M'; sync; date;
Tue Aug 11 13:01:41 CEST 2015
0+466899 records in
0+466899 records out
4244635648 bytes (4.2 GB) copied, 201.041 s, 21.1 MB/s
Tue Aug 11 13:05:03 CEST 2015

## Older XU4 image instead:
$ xz --decompress --stdout --verbose 'ubuntu-14.04lts-server-odroidxu4-20150802.img.xz' | dd of='/dev/disk/by-id/mmc-064GE2_0xde70c8b3' bs='1M';
ubuntu-14.04lts-server-odroidxu4-20150802.img.xz (1/1)
  100 %       166.7 MiB / 740.0 MiB = 0.225    66 MiB/s       0:11            

0+94683 records in
0+94683 records out
775946240 bytes (776 MB) copied, 45.3486 s, 17.1 MB/s

$ sync;
$ sleep 120;
$ sync;

$ partprobe '/dev/disk/by-id/mmc-064GE2_0x1bd89870';

$ parted '/dev/disk/by-id/mmc-064GE2_0x1bd89870' -- unit kib print free;
Model: MMC 064GE2 (sd/mmc)
Disk /dev/mmcblk0: 61071360kiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start       End          Size         Type     File system  Flags
        31.5kiB     1024kiB      993kiB                Free Space
1      1024kiB     132096kiB    131072kiB    primary  fat16        lba
2      132096kiB   4145152kiB   4013056kiB   primary  ext2
        4145152kiB  61071360kiB  56926208kiB           Free Space

## if you want to use all remaining available space for the root file system itself,
## you have to increase the 2nd partition size.
## as i want to use the additional space for a dedicated storage partition i do not do this.

$ mount '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part1' /mnt/;
$ ls -las /mnt/;
total 7108
  16 drwxr-xr-x.  2 root root   16384 Jan  1  1970 .
   4 dr-xr-xr-x. 18 root root    4096 Jun 16 11:12 ..
   6 -rwxr-xr-x.  1 root root    4511 Jul  7 23:39 boot.ini
  50 -rwxr-xr-x.  1 root root   50481 Jul 10 23:44 exynos5422-odroidxu3.dtb
3874 -rwxr-xr-x.  1 root root 3965972 Jul 10 23:44 uInitrd
3158 -rwxr-xr-x.  1 root root 3232216 Jul 10 23:44 zImage

$ grep -v -- '^\s*$\|^\s*#' /mnt/boot.ini;
ODROIDXU-UBOOT-CONFIG
setenv initrd_high "0xffffffff"
setenv fdt_high "0xffffffff"
setenv macaddr "00:1e:06:61:7a:39"
setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes"
setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; fatload mmc 0:1 0x44000000 exynos5422-odroidxu3.dtb; bootz 0x40008000 0x42000000 0x44000000"
setenv governor "performance"
setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr} governor=${governor}"
boot

$ grep -i --color -- 'XKBLAYOUT' /mnt/boot.ini;
<EMPTY>

$ grep --color -- '^setenv macaddr.*' /mnt/boot.ini;
setenv macaddr "00:1e:06:61:7a:39"

$ cp -ai /mnt/boot.ini /mnt/boot.bkp;

## make sure you MAC address is unique in your subnet (if you hook several odroids together).
$ sed 's%^setenv macaddr .*%setenv macaddr "00:1e:06:00:00:01"%' /mnt/boot.ini | grep -- '^setenv macaddr';
setenv macaddr "00:1e:06:00:00:01"
$ sed -i 's%^setenv macaddr .*%setenv macaddr "00:1e:06:00:00:01"%' /mnt/boot.ini | grep -- '^setenv macaddr';
$ grep --color -- '^setenv macaddr.*' /mnt/boot.ini;
setenv macaddr "00:1e:06:00:00:01"

## your image should already point the linux kernel to the ext4 root file system UUID.
$ grep --color -- 'root=UUID=[^ ]*' /mnt/boot.ini;
setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes"

$ blkid '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2';
/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2: LABEL="rootfs" UUID="e139ce78-9841-40fe-8823-96a304a09859" TYPE="ext4" PARTUUID="0008aae4-02"

$ umount /mnt;

$ mount '/dev/disk/by-id/mmc-064GE2_0x1bd89870-part2' /mnt/;

$ ls -las /mnt/;
total 112
4 drwxr-xr-x.  21 root root  4096 Jul 11 01:16 .
4 dr-xr-xr-x.  18 root root  4096 Jun 16 11:12 ..
4 drwxr-xr-x.   2 root root  4096 Jul  7 23:37 bin
4 drwxr-xr-x.   2 root root  4096 Jul 10 23:59 boot
4 drwxr-xr-x.   4 root root  4096 May  9 02:53 dev
12 drwxr-xr-x. 137 root root 12288 Jul 10 23:44 etc
4 drwxr-xr-x.   3 root root  4096 May  9 09:37 home
4 drwxr-xr-x.  22 root root  4096 Jul  9 16:37 lib
16 drwx------.   2 root root 16384 May  9 02:34 lost+found
4 drwxr-xr-x.   3 root root  4096 May  9 02:34 media
4 drwxr-xr-x.   2 root root  4096 Apr 17 23:35 mnt
4 drwxr-xr-x.   2 root root  4096 May  9 02:39 opt
4 drwxr-xr-x.   2 root root  4096 Apr 17 23:35 proc
4 drwx------.   4 root root  4096 Jul 11 01:16 root
4 drwxr-xr-x.   9 root root  4096 May  9 03:34 run
12 drwxr-xr-x.   2 root root 12288 Jul  7 23:38 sbin
4 drwxr-xr-x.   2 root root  4096 May  9 02:39 srv
4 drwxr-xr-x.   2 root root  4096 Apr  6 20:45 sys
4 drwxrwxrwt.   7 root root  4096 Jul 11 00:45 tmp
4 drwxr-xr-x.  10 root root  4096 May  9 02:39 usr
4 drwxr-xr-x.  13 root root  4096 Jul  9 16:37 var

$ cat '/mnt/etc/lightdm/users.conf';
#
# User accounts configuration
#
# NOTE: If you have AccountsService installed on your system, then LightDM will
# use this instead and these settings will be ignored
#
# minimum-uid = Minimum UID required to be shown in greeter
# hidden-users = Users that are not shown to the user
# hidden-shells = Shells that indicate a user cannot login
#
[UserList]
minimum-uid=500
hidden-users=nobody nobody4 noaccess
hidden-shells=/bin/false /usr/sbin/nologin

$ grep -i -A8 -- 'UART serial ports' /mnt/etc/securetty;
# UART serial ports
ttyS0
ttyS1
ttyS2
ttyS3
ttyS4
ttyS5
#...ttyS191


#################################################
## accounts

$ grep -- '^root\|^odroid' /mnt/etc/passwd;
root:x:0:0:root:/root:/bin/bash
odroid:x:1000:1000:,,,:/home/odroid:/bin/bash

$ grep -- '^root\|^odroid' /mnt/etc/shadow;
root:$6$uIioyBxG$B3S3CSRp3TeHpi223soi37fzpLS1T1QmAE087AkWeYysMpZHhgu3KfHWcYAJXuVimSs5sLIRgsa.fWSJ33g9E1:16564:0:99999:7:::
odroid:$6$TtXg2l9R$DFu4/RQCDTZQypLFdMH9VqcS9Z9of/oGTssGqcnIrH8eqQeTkN59u/jWxGjWHp5arS4plr3DvRtZoHHA7iaCh.:16564:0:99999:7:::

## root/root did not work for my image, so let's switch to blank
## "The default user is root and login password is root."

$ cp -ai /mnt/etc/shadow{,bkp}

$ grep -- '^root\|^odroid' /mnt/etc/shadow;
root:*:16335:0:99999:7:::
odroid:$6$CKo3eMnE$WeEKGlWaaZEpJtzeXMKEWL9i9vZRWwgOKRei02HdTfiEafjw56iYhQygcw9srex8f8ffP6CRDC0H4TQbYeQw40:16649:0:99999:7:::

$ grep -- '^root\|^odroid' /mnt/etc/shadow;
root:$6$0ZjCqz21$KXDKnoYCuWSoo5JQFhka3nREWxFp5YNoM5tOoWUU5cvPBFlwKMZbBZswHu0jZtcQXj8Vj2xbIAjoDS0tm7q0K0:16335:0:99999:7:::
odroid:$6$0ZjCqz21$KXDKnoYCuWSoo5JQFhka3nREWxFp5YNoM5tOoWUU5cvPBFlwKMZbBZswHu0jZtcQXj8Vj2xbIAjoDS0tm7q0K0:16649:0:99999:7:::

$ ll /mnt/etc/shadow*;
-rw-r-----. 1 root gdm  839 Aug 14 11:52 /mnt/etc/shadow
-rw-------. 1 root root 742 Aug  2 11:44 /mnt/etc/shadow-
-rw-r-----. 1 root gdm  839 Aug 14 11:52 /mnt/etc/shadow.bkp
-rw-r-----. 1 root gdm  742 Aug  2 18:51 /mnt/etc/shadow.orig


#################################################
## network

$ cat /mnt/etc/network/interfaces;
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

$ ls -ltr /mnt/etc/network/interfaces.d/;
total 0

$ ls -ltr /mnt/etc/network/interfaces.d/;
total 4
-rw-r--r--. 1 root root 105 Aug 13 18:31 eth

$ cat /mnt/etc/network/interfaces.d/eth0;
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.100.101
        netmask 255.255.255.0
        gateway 192.168.100.1

$ grep '^SUBSYSTEM==' /mnt/etc/udev/rules.d/70-persistent-net.rules;
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:30:00:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

## if you have already failed to boot the image,
## and checked that the ethernet interface on the udroid-xu4 does blink on incoming ICMP packages,
## the network configuration might also

# grep -- 'r8152' /mnt/var/log/syslog | tail;
Jan  1 12:02:22 odroid-server kernel: [    5.778800] r8152 6-1:1.0 eth0: This product is covered by one or more of the following patents:
Jan  1 12:02:22 odroid-server kernel: [    5.914524] r8152 6-1:1.0 eth1: renamed from eth0
Jan  1 12:02:18 odroid-server kernel: [    5.393705] usbcore: registered new interface driver r8152
Jan  1 12:02:19 odroid-server kernel: [    5.608152] r8152 6-1:1.0 eth0: v2.04.0 (2015/03/06)
Jan  1 12:02:19 odroid-server kernel: [    5.608169] r8152 6-1:1.0 eth0: This product is covered by one or more of the following patents:
Jan  1 12:02:19 odroid-server kernel: [    5.881586] r8152 6-1:1.0 eth1: renamed from eth0
Jan  1 12:00:08 odroid-server kernel: [    5.482258] usbcore: registered new interface driver r8152
Jan  1 12:00:08 odroid-server kernel: [    5.681327] r8152 6-1:1.0 eth0: v2.04.0 (2015/03/06)
Jan  1 12:00:08 odroid-server kernel: [    5.681347] r8152 6-1:1.0 eth0: This product is covered by one or more of the following patents:
Jan  1 12:00:08 odroid-server kernel: [    5.948466] r8152 6-1:1.0 eth1: renamed from eth0

$ grep '^SUBSYSTEM==' /mnt/etc/udev/rules.d/70-persistent-net.rules;
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:31:06:86", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:30:00:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

## fix the udev rule to pin eth0 to YOUR MAC address

$ grep '^SUBSYSTEM==' /mnt/etc/udev/rules.d/70-persistent-net.rules;
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:30:00:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


#################################################
## ssh

$ cd /mnt/etc/systemd/system/;

$ cp -ai /mnt/etc/ssh/sshd_config{,.bkp};

$ sed 's%^PermitRootLogin.*%PermitRootLogin yes%' /mnt/etc/ssh/sshd_config | grep -- '^PermitRootLogin';
PermitRootLogin yes

$ sed -i 's%^PermitRootLogin.*%PermitRootLogin yes%' /mnt/etc/ssh/sshd_config;

$ grep -- '^PermitRootLogin' /mnt/etc/ssh/sshd_config;
PermitRootLogin yes

## The standard target is default.target,
## which is aliased by default to graphical.target (which roughly corresponds to the old runlevel 5)

$ ls -las /mnt/etc/systemd/system/default.target;
-bash: /mnt/etc/systemd/system/default.target: No such file or directory

$ cd /mnt/etc/systemd/system/;

## the symlink currently points to our host systemd target file,
## but will point to the odroid system on booting from the eMMC card.

$ ls -las /mnt/etc/systemd/system/default.target;
0 lrwxrwxrwx. 1 root root 37 Aug 11 15:20 /mnt/etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target

$ rm -i /mnt/etc/systemd/system/default.target;
rm: remove symbolic link '/mnt/etc/systemd/system/default.target'? y

$ ln -s /lib/systemd/system/default.target default.target;

$ ls -las /mnt/etc/systemd/system/default.target;
0 lrwxrwxrwx. 1 root root 34 Aug 13 18:46 /mnt/etc/systemd/system/default.target -> /lib/systemd/system/default.target

$ ls -l 'default.target';

$ ls -l 'default.target';
lrwxrwxrwx. 1 root root 34 Aug 13 18:46 default.target -> /lib/systemd/system/default.target

$ mkdir /mnt/etc/systemd/system/default.target.wants/;

$ cp -ai /mnt/lib/systemd/system/ssh.service /mnt/etc/systemd/system/default.target.wants/;

$ grep -- '^WantedBy=' /mnt/etc/systemd/system/default.target.wants/ssh.service;
WantedBy=multi-user.target

$ sed -i 's%^WantedBy=.*%WantedBy=default.target.wants%' /mnt/etc/systemd/system/default.target.wants/ssh.service;

$ grep -- '^WantedBy=' /mnt/etc/systemd/system/default.target.wants/ssh.service;
WantedBy=default.target.wants

$ grep -- '^After=' /mnt/etc/systemd/system/default.target.wants/ssh.service;
After=network.target auditd.service

$ cd;

$ sync;

$ umount /mnt/boot;

$ umount /mnt/;

$ fsck.ext4 -y -f -v -D /dev/mmcblk0p2;
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

rootfs: ***** FILE SYSTEM WAS MODIFIED *****

       26300 inodes used (0.73%, out of 3594752)
           7 non-contiguous files (0.0%)
           5 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 22567/1
      368214 blocks used (2.36%, out of 15583488)
           0 bad blocks
           1 large file

       19921 regular files
        2503 directories
          56 character device files
          25 block device files
           0 fifos
          16 links
        3786 symbolic links (3643 fast symbolic links)
           0 sockets
------------
       26307 files

## WARNING: after every failed try you have to remove the dirty bit on the fat32 boot partition.
$ fsck.vfat -a -w /dev/mmcblk0p1;
fsck.fat 3.0.27 (2014-11-12)
0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
Automatically removing dirty bit.
Performing changes.
/dev/mmcblk0p1: 18 files, 13675/16343 clusters

$ fsck.vfat -a -w /dev/mmcblk0p1;
fsck.fat 3.0.27 (2014-11-12)
/dev/mmcblk0p1: 18 files, 13675/16343 clusters


#################################################
## Put Recovery Image Boot Loader on Micro SD Card

## we have to put the uboot boot loader on the first partition of the boot partition of the Micro SD Card.

# kpartx -av android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img
add map loop0p1 (253:4): 0 819200 linear /dev/loop0 204800

$ mount /dev/mapper/loop0p1 /media/;

$ ls -las /media/;
total 399128
     4 drwxr-xr-x.  2 root root      4096 Jan  1  1970 .
     4 dr-xr-xr-x. 18 root root      4096 Jun 16 11:12 ..
    16 -rwxr-xr-x.  1 root root     15360 Jul 20 18:25 bl1.bin
    16 -rwxr-xr-x.  1 root root     14592 Jul 20 18:25 bl2.bin
     4 -rwxr-xr-x.  1 root root      3640 Jul 20 18:37 boot.ini
  6204 -rwxr-xr-x.  1 root root   6348948 Jul 20 18:25 cache.img
   388 -rwxr-xr-x.  1 root root    393966 Jul 20 18:25 ramdisk.img
346836 -rwxr-xr-x.  1 root root 355159872 Jul 20 18:25 system.img
   256 -rwxr-xr-x.  1 root root    262144 Jul 20 18:25 tzsw.bin
   272 -rwxr-xr-x.  1 root root    275684 Jul 20 18:25 u-boot.bin
35984 -rwxr-xr-x.  1 root root  36844316 Jul 20 18:25 userdata.img
  4572 -rwxr-xr-x.  1 root root   4680958 Jul 20 18:25 zImage
  4572 -rwxr-xr-x.  1 root root   4680958 Jul 20 18:25 zImage-dtb

$ ls -ltr /dev/disk/by-id/mmc*;
lrwxrwxrwx. 1 root root 13 Aug 13 18:54 /dev/disk/by-id/mmc-SU64G_0x101ffb35 -> ../../mmcblk0
lrwxrwxrwx. 1 root root 15 Aug 13 18:54 /dev/disk/by-id/mmc-SU64G_0x101ffb35-part1 -> ../../mmcblk0p1
lrwxrwxrwx. 1 root root 15 Aug 13 18:54 /dev/disk/by-id/mmc-SU64G_0x101ffb35-part2 -> ../../mmcblk0p2

$ mount '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part2' /mnt/;

$ mount '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part1' /mnt/boot/;

$ rsync --archive --progress --exclude='system.img' --exclude='userdata.img' /media/* /mnt/boot/;
sending incremental file list
...

$ ls -las /mnt/boot/*4.2.0-rc1-41*;
  46 -rwxr-xr-x. 1 root root   45289 Aug  2 21:33 /mnt/boot/exynos5422-odroidxu4-4.2.0-rc1-41.dtb
3230 -rwxr-xr-x. 1 root root 3305484 Aug  2 21:33 /mnt/boot/uInitrd-4.2.0-rc1-41
3856 -rwxr-xr-x. 1 root root 3948240 Aug  2 21:33 /mnt/boot/vmlinuz-4.2.0-rc1-41

$ cp -ai /mnt/boot/boot.ini{,.bkp2};

$ cp -ai ~/boot.ini /mnt/boot/;
cp: overwrite '/mnt/boot/boot.ini'? y

$ cat /mnt/boot/boot.ini;
ODROIDXU-UBOOT-CONFIG

# U-Boot Parameters (DO NOT MODIFY)
setenv version 4.2.0-rc1-41
setenv zimage vmlinuz-${version}
setenv uinitrd uInitrd-${version}
setenv fdtbin exynos5422-odroidxu4-${version}.dtb

setenv zimage_addr_r 0x40008000
setenv initrd_addr_r 0x42000000
setenv fdtbin_addr_r 0x44000000

setenv initrd_high "0xffffffff"
setenv fdt_high "0xffffffff"

# Default boot argument
setenv bootrootfs "root=/dev/mmcblk0p2 rootwait ro"
setenv console "console=ttySAC2,115200n8"

setenv bootargs "${bootrootfs} ${console}"

# boot commands
fatload mmc 0:1 ${zimage_addr_r} ${zimage}
fatload mmc 0:1 ${initrd_addr_r} ${uinitrd}
fatload mmc 0:1 ${fdtbin_addr_r} ${fdtbin}
bootz ${zimage_addr_r} ${initrd_addr_r} ${fdtbin_addr_r}"

$ umount /dev/mapper/loop0p1

$ losetup -a;
/dev/loop0: [64771]:7084457 (/path/to/android-4.4.4-alpha-2.4-sd2emmc_installer-odroidxu3-20150720.img)

$ losetup -d '/dev/loop0'; 


#################################################
## Boot From Micro SD Card for SSH Access via Manual IP.

## check that your laptop brings up the link properly with rx/tx flow control
$ dmesg | tail -n4;
[14460.023743] e1000e: enp0s25 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
[14464.643823] e1000e: enp0s25 NIC Link is Down
[14466.636304] e1000e 0000:00:19.0 enp0s25: PHY Wakeup cause - Link Status Change
[14470.207053] e1000e: enp0s25 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx

$ ip a l 'enp0s25';
3: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 68:f7:28:b1:ea:90 brd ff:ff:ff:ff:ff:ff

$ ip a a 192.168.100.100/24 dev enp0s25;

$ ip l s dev enp0s25 up;

$ ethtool enp0s25 | grep -- 'Link detected:';
        Link detected: yes

$ ping -c2 192.168.100.101;
PING 192.168.100.101 (192.168.100.101) 56(84) bytes of data.
64 bytes from 192.168.100.101: icmp_seq=1 ttl=64 time=0.545 ms
64 bytes from 192.168.100.101: icmp_seq=2 ttl=64 time=0.539 ms

--- 192.168.100.101 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.539/0.542/0.545/0.003 ms

$ ssh -2 root@192.168.100.101;
root@192.168.100.101's password: odroid
Welcome to Ubuntu 14.04 (GNU/Linux 4.2.0-rc1-41 armv7l)

* Documentation:  https://help.ubuntu.com/
Last login: Sat Jan  1 12:00:11 2000

root@odroid-server:~#

root@odroid-server:~# lspci;
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.

## if your network already does internet routing on 192.168.100.1, then you already have proper timing.
root@odroid-server:~# tail -n4 /var/log/syslog;
Jan  1 12:00:12 odroid-server /etc/mysql/debian-start[2440]: FATAL ERROR: Upgrade failed
Jan  1 12:00:12 odroid-server /etc/mysql/debian-start[2454]: Checking for insecure root accounts.
Aug 15 09:51:47 odroid-server ntpdate[2081]: step time server 91.189.94.4 offset 492904286.921689 sec
Aug 15 09:52:03 odroid-server ntpdate[2468]: adjust time server 91.189.89.199 offset 0.000229 sec

root@odroid-server:~# ntpdate -bvu '91.189.94.4';
15 Aug 09:53:57 ntpdate[2536]: ntpdate 4.2.6p5@1.2349-o Wed Oct  9 18:59:44 UTC 2013 (1)
15 Aug 09:54:03 ntpdate[2536]: step time server 91.189.94.4 offset -0.000305 sec


#################################################
## Odroid XU4 Linux Operating System

root@odroid-server:~# uname -a;
Linux odroid-server 4.2.0-rc1-41 #19 SMP PREEMPT Sun Aug 2 04:45:11 KST 2015 armv7l armv7l armv7l GNU/Linux

## Oct-Core ARM Little-Big 4x A15 + 4x A7 active:
root@odroid-server:~# grep -c -- '^processor' /proc/cpuinfo;
8
root@odroid-server:~# grep -- '^model name' /proc/cpuinfo | sort | uniq -c;
      8 model name      : ARMv7 Processor rev 3 (v7l)
root@odroid-server:~# grep -- '^BogoMIPS' /proc/cpuinfo | sort | uniq -c;
      4 BogoMIPS        : 120.00
      4 BogoMIPS        : 84.00

root@odroid-server:~# free -m;
             total       used       free     shared    buffers     cached
Mem:          1983        132       1850          5          4         51
-/+ buffers/cache:         76       1906
Swap:            0          0          0

root@odroid-server:~# ip a l;
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1e:06:30:00:36 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.101/24 brd 192.168.100.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::21e:6ff:fe30:36/64 scope link
       valid_lft forever preferred_lft forever

root@odroid-server:~# grep -- '^SUBSYSTEM=' /etc/udev/rules.d/70-persistent-net.rules;
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:30:00:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

root@odroid-server:~# cat /etc/network/interfaces.d/eth0;
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.100.101
        netmask 255.255.255.0
        gateway 192.168.100.1

root@odroid1:~# sed -i -- 's%gateway .*%gateway 192.168.100.100%' /etc/network/interfaces.d/eth0;

root@odroid1:~# cat /etc/network/interfaces.d/eth0;
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.100.101
        netmask 255.255.255.0
        gateway 192.168.100.100

root@odroid-server:~# df -Th;
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2 ext4      7.7G  541M  6.9G   8% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
udev           devtmpfs   10M  4.0K   10M   1% /dev
tmpfs          tmpfs     397M  292K  397M   1% /run
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs     992M     0  992M   0% /run/shm
none           tmpfs     100M     0  100M   0% /run/user
/dev/mmcblk0p1 vfat       32M   27M  5.3M  84% /boot

root@odroid-server:~# ls -ltr /dev/disk/by-id/;
total 0
lrwxrwxrwx 1 root root 13 Jan  1 12:00 mmc-064GE2_0xde70c8b3 -> ../../mmcblk1
lrwxrwxrwx 1 root root 15 Jan  1 12:00 mmc-064GE2_0xde70c8b3-part1 -> ../../mmcblk1p1
lrwxrwxrwx 1 root root 13 Jan  1 12:00 mmc-SU64G_0x101ffb35 -> ../../mmcblk0
lrwxrwxrwx 1 root root 15 Jan  1 12:00 mmc-064GE2_0xde70c8b3-part2 -> ../../mmcblk1p2
lrwxrwxrwx 1 root root 15 Jan  1 12:00 mmc-SU64G_0x101ffb35-part2 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Jan  1 12:00 mmc-SU64G_0x101ffb35-part1 -> ../../mmcblk0p1

root@odroid-server:~# parted '/dev/disk/by-id/mmc-SU64G_0x101ffb35' -- unit mib print free;
Model: SD SU64G (sd/mmc)
Disk /dev/mmcblk0: 60906MiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start    End       Size      Type     File system  Flags
        0.03MiB  1.00MiB   0.97MiB            Free Space
1      1.00MiB  33.0MiB   32.0MiB   primary  fat16        lba
2      33.0MiB  60906MiB  60873MiB  primary  ext4

root@odroid-server:~# resize2fs -p /dev/mmcblk0p2;
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/mmcblk0p2 is now 15583488 blocks long.

root@odroid-server:~# df -Th;
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2 ext4       59G  541M   57G   1% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
udev           devtmpfs   10M  4.0K   10M   1% /dev
tmpfs          tmpfs     397M  292K  397M   1% /run
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs     992M     0  992M   0% /run/shm
none           tmpfs     100M     0  100M   0% /run/user
/dev/mmcblk0p1 vfat       32M   27M  5.3M  84% /boot

root@odroid-server:~# df -Th /;
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/mmcblk0p2 ext4   59G  541M   57G   1% /

root@odroid-server:~# parted '/dev/disk/by-id/mmc-064GE2_0xde70c8b3' -- unit mib print free;
Model: MMC 064GE2 (sd/mmc)
Disk /dev/mmcblk1: 59640MiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start    End       Size      Type     File system  Flags
        0.03MiB  1.00MiB   0.97MiB            Free Space
1      1.00MiB  33.0MiB   32.0MiB   primary  fat16        lba
2      33.0MiB  59640MiB  59607MiB  primary  ext4


#################################################
## Prepare eMMC Card As Ceph OSD Block Device

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part2';
offset               type
----------------------------------------------------------------
0x438                ext4   [filesystem]
                     LABEL: rootfs
                     UUID:  669a4d12-4c0d-4b61-a5fc-9de45699973b

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
offset               type
----------------------------------------------------------------
0x36                 vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  1F12-97C4

root@odroid-server:~# wipefs -o '0x438' '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part2';

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part2';
<EMPTY>

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
offset               type
----------------------------------------------------------------
0x36                 vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  1F12-97C4

root@odroid-server:~# wipefs -o '0x36' '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
8 bytes were erased at offset 0x36 (vfat)
they were: 46 41 54 31 36 20 20 20

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
offset               type
----------------------------------------------------------------
0x0                  vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  1F12-97C4

root@odroid-server:~# wipefs -o '0x0' '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
1 bytes were erased at offset 0x0 (vfat)
they were: eb

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
offset               type
----------------------------------------------------------------
0x1fe                vfat   [filesystem]
                     LABEL: BOOT
                     UUID:  1F12-97C4

root@odroid-server:~# wipefs -o '0x1fe' '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
2 bytes were erased at offset 0x1fe (vfat)
they were: 55 aa

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3-part1';
<EMPTY>

root@odroid-server:~# wipefs '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
wipefs: WARNING: /dev/disk/by-id/mmc-064GE2_0xde70c8b3: appears to contain 'dos' partition table

root@odroid-server:~# partprobe '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';

root@odroid-server:~# ls -l '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
lrwxrwxrwx 1 root root 13 Jan  1 12:00 /dev/disk/by-id/mmc-064GE2_0xde70c8b3 -> ../../mmcblk1

root@odroid-server:~# blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
62537072640

root@odroid-server:~# echo "$(( 62537072640 / 1024 / 1024 / 1024 )) GiB";
58 GiB


#################################################
## Ubuntu Network Access

## control system
$ ip a a 192.168.100.100/24 dev enp0s25;
$ ip a a 192.168.100.1/24 dev enp0s25;
$ ip l s dev enp0s25 up;

## odroid
root@odroid-server:~# ip r l;
default via 192.168.100.1 dev eth0
192.168.100.0/24 dev eth0  proto kernel  scope link  src 192.168.100.101

root@odroid-server:~# ip r d default;
root@odroid-server:~# ip r a default via '192.168.100.100';

root@odroid-server:~# ip r l default;
default via 192.168.100.100 dev eth0
192.168.100.0/24 dev eth0  proto kernel  scope link  src 192.168.100.101

root@odroid-server:~# cat /etc/resolv.conf;
nameserver 168.126.63.1
nameserver 168.126.63.2

## private DNS server on jumphost
root@odroid-server:~# echo 'nameserver 192.168.100.100' > /etc/resolv.conf;

## public Google DNS server
root@odroid-server:~# echo 'nameserver 8.8.8.8' > /etc/resolv.conf;

root@odroid-server:~# cat /etc/resolv.conf;
nameserver 192.168.100.100

root@odroid-server:~# ping -c2 192.168.100.100;
PING 192.168.100.100 (192.168.100.100) 56(84) bytes of data.
64 bytes from 192.168.100.100: icmp_seq=1 ttl=64 time=0.486 ms
64 bytes from 192.168.100.100: icmp_seq=2 ttl=64 time=0.543 ms

root@odroid-server:~# nslookup 'matrix-universe.eu';
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   matrix-universe.eu
Address: 176.9.157.203

root@odroid-server:~# ping -c2 matrix-universe.eu;
PING matrix-universe.eu (176.9.157.203) 56(84) bytes of data.
64 bytes from matrix-universe.eu (176.9.157.203): icmp_seq=1 ttl=53 time=80.5 ms
64 bytes from matrix-universe.eu (176.9.157.203): icmp_seq=2 ttl=53 time=62.3 ms

root@odroid-server:~# hostname -s;
odroid-server

root@odroid-server:~# hostname -f;
odroid-server

root@odroid-server:~# hostnamectl set-hostname 'odroid1.odroids.local';
Failed to issue method call: Failed to execute program /usr/lib/dbus-1.0/dbus-daemon-launch-helper: Success

root@odroid-server:~# echo 'odroid1.odroids.local' > /etc/hostname;

root@odroid-server:~# hostname 'odroid1.odroids.local';

root@odroid-server:~# echo '192.168.100.101 odroid1.odroids.local odroid1' >> /etc/hosts;

root@odroid-server:~# ping -c2 odroid1.odroids.local;
PING odroid1.odroids.local (192.168.100.101) 56(84) bytes of data.
64 bytes from odroid1.odroids.local (192.168.100.101): icmp_seq=1 ttl=64 time=0.076 ms
64 bytes from odroid1.odroids.local (192.168.100.101): icmp_seq=2 ttl=64 time=0.052 ms

root@odroid1:~# hostname -s;
odroid1

root@odroid1:~# hostname -f;
odroid1.odroids.local


#################################################
## Ubuntu Package Repository Access

root@odroid1:~# apt-get install 'aptitude';
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  apt-xapian-index aptitude-common libboost-iostreams1.54.0 libclass-accessor-perl libcwidget3 libept1.4.12 libio-string-perl
  libparse-debianchangelog-perl libsigc++-2.0-0c2a libsub-name-perl libtimedate-perl libxapian22 python-apt python-debian python-xapian
Suggested packages:
  app-install-data python-xdg aptitude-doc-en aptitude-doc tasksel debtags libcwidget-dev libhtml-parser-perl libxml-simple-perl
  xapian-tools python-apt-dbg python-gtk2 python-vte python-apt-doc xapian-doc
The following NEW packages will be installed:
  apt-xapian-index aptitude aptitude-common libboost-iostreams1.54.0 libclass-accessor-perl libcwidget3 libept1.4.12 libio-string-perl
  libparse-debianchangelog-perl libsigc++-2.0-0c2a libsub-name-perl libtimedate-perl libxapian22 python-apt python-debian python-xapian
0 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
Need to get 3380 kB of archives.
After this operation, 13.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

root@odroid1:~# aptitude update;
...

root@odroid1:~# aptitude install -y screen vim-runtime vim htop;
...

root@odroid1:~# vim --version | head -n1;
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:49:14)

root@odroid1:~# history -w;

root@odroid1:~# screen -R -D;

root@odroid1:~# uname -a;
Linux odroid1.odroids.local 4.2.0-rc1-41 #19 SMP PREEMPT Sun Aug 2 04:45:11 KST 2015 armv7l armv7l armv7l GNU/Linux

root@odroid1:~# rm -i /boot/uInitrd /boot/zImage /boot/zImage-dtb;
rm: remove regular file ‘/boot/uInitrd’? y
rm: remove regular file ‘/boot/zImage’? y
rm: remove regular file ‘/boot/zImage-dtb’? y

root@odroid1:~# df -Th /boot/ /lib/modules/;
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/mmcblk0p1 vfat   32M   14M   18M  44% /boot
/dev/mmcblk0p2 ext4   59G  706M   57G   2% /

root@odroid1:~# aptitude search 'linux-image-[0-9]';
v   linux-image-3.0                                              -                                                                      
p   linux-image-3.0.0-3-maguro                                   - Linux kernel image for version 3.0.0 on Galaxy Nexus                 
p   linux-image-3.1.10-8-grouper                                 - Linux kernel image for version 3.1.10 on Nexus 7                     
p   linux-image-3.13.0-24-generic                                - Linux kernel image for version 3.13.0 on ARM (hard float) SMP        
p   linux-image-3.13.0-24-generic-lpae                           - Linux kernel image for version 3.13.0 on ARM (hard float) SMP        
p   linux-image-3.13.0-3-exynos5                                 - Linux kernel image for version 3.13.0 on ARM (hard float) SMP        
p   linux-image-3.4.0-3-flo                                      - Linux kernel image for version 3.4.0 on Nexus 10                     
p   linux-image-3.4.0-3-goldfish                                 - Linux kernel image for version 3.4.0 on Android touch emulation      
p   linux-image-3.4.0-5-chromebook                               - Linux kernel image for version 3.4.0 on Samsung Chromebook           
p   linux-image-3.4.0-5-mako                                     - Linux kernel image for version 3.4.0 on Nexus 4                      
p   linux-image-3.4.0-6-manta                                    - Linux kernel image for version 3.4.0 on Nexus 10                     
p   linux-image-4.2.0-rc1-odroidxu4                              - Linux kernel, version 4.2.0-rc1

root@odroid1:~# aptitude dist-upgrade;

root@odroid1:~# aptitude install -y 'linux-image-4.2.0-rc1-odroidxu4';
The following NEW packages will be installed:
  linux-image-4.2.0-rc1-odroidxu4
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/8078 kB of archives. After unpacking 20.4 MB will be used.
Selecting previously unselected package linux-image-4.2.0-rc1-odroidxu4.
(Reading database ... 21803 files and directories currently installed.)
Preparing to unpack .../linux-image-4.2.0-rc1-odroidxu4_48.0-0~18~ubuntu14.04.1_armhf.deb ...
Unpacking linux-image-4.2.0-rc1-odroidxu4 (48.0-0~18~ubuntu14.04.1) ...
Setting up linux-image-4.2.0-rc1-odroidxu4 (48.0-0~18~ubuntu14.04.1) ...
update-initramfs: Generating /boot/initrd.img-4.2.0-rc1-48
grep: /boot/config-4.2.0-rc1-48: No such file or directory
Image Name:   uInitrd
Created:      Sat Jan  1 13:22:44 2000
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    4558415 Bytes = 4451.58 kB = 4.35 MB
Load Address: 42000000
Entry Point:  42000000

root@odroid1:~# df -Th /boot/ /lib/modules/;
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/mmcblk0p1 vfat   32M   23M  9.8M  70% /boot
/dev/mmcblk0p2 ext4   59G  748M   56G   2% /

root@odroid1:~# ls -las /boot/*-48*;
  44 -rwxr-xr-x 1 root root   45027 Jan  1 13:22 /boot/exynos5422-odroidxu4-4.2.0-rc1-48.dtb
4452 -rwxr-xr-x 1 root root 4558479 Jan  1 13:22 /boot/uInitrd-4.2.0-rc1-48
3864 -rwxr-xr-x 1 root root 3954968 Jan  1 13:22 /boot/vmlinuz-4.2.0-rc1-48

root@odroid1:~# file /boot/vmlinuz-4.2.0-rc1-48;
/boot/vmlinuz-4.2.0-rc1-48: Linux kernel ARM boot executable zImage (little-endian)

root@odroid1:~# file /boot/uInitrd-4.2.0-rc1-48;
/boot/uInitrd-4.2.0-rc1-48: u-boot legacy uImage, uInitrd, Linux/ARM, RAMDisk Image (gzip), 4558415 bytes, Sat Jan  1 13:22:44 2000, Load Address: 0x42000000, Entry Point: 0x42000000, Header CRC: 0x4AEE90EF, Data CRC: 0x50BCAFC0

root@odroid1:~# file /boot/exynos5422-odroidxu4-4.2.0-rc1-48.dtb;
/boot/exynos5422-odroidxu4-4.2.0-rc1-48.dtb: data

root@odroid1:~# grep -- '^setenv version' /boot/boot.ini;
setenv version 4.2.0-rc1-48

root@odroid1:~# uname -a;
Linux odroid1.odroids.local 4.2.0-rc1-41 #19 SMP PREEMPT Sun Aug 2 04:45:11 KST 2015 armv7l armv7l armv7l GNU/Linux


#################################################
## Operating System Cleanup

root@odroid1:~# aptitude search 'apache' | grep -- '^i';
i   apache2                         - Apache HTTP Server                       
i A apache2-bin                     - Apache HTTP Server (binary files and modul
i A apache2-data                    - Apache HTTP Server (common files)        
i   apache2-mpm-prefork             - transitional prefork MPM package for apach
i   libapache2-mod-php5             - server-side, HTML-embedded scripting langu

root@odroid1:~# aptitude search 'mysql' | grep -- '^i';
i A libdbd-mysql-perl               - Perl5 database interface to the MySQL data
i A libmysqlclient18                - MySQL database client library            
i A mysql-client-5.5                - MySQL database client binaries           
i A mysql-client-core-5.5           - MySQL database core client binaries      
i A mysql-common                    - MySQL database common files, e.g. /etc/mys
i   mysql-server                    - MySQL database server (metapackage dependi
i A mysql-server-5.5                - MySQL database server binaries and system
i A mysql-server-core-5.5           - MySQL database server binaries           
i   php5-mysql                      - MySQL module for php5   

root@odroid1:~# service 'apache2' stop;
* Stopping web server apache2

root@odroid1:~# service 'mysql' stop;
mysql stop/waiting

root@odroid1:~# aptitude remove -y linaro-lamp-server mysql-server;
The following packages will be REMOVED: 
  libaio1{u} libdbd-mysql-perl{u} libdbi-perl{u} libterm-readkey-perl{u} linaro-lamp-server mysql-client-5.5{u}
  mysql-client-core-5.5{u} mysql-server mysql-server-5.5{u} mysql-server-core-5.5{u}
0 packages upgraded, 0 newly installed, 10 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 82.0 MB will be freed.
Do you want to continue? [Y/n/?] y
(Reading database ... 22410 files and directories currently installed.)
Removing linaro-lamp-server (039-trusty3) ...
Removing mysql-server (5.5.35+dfsg-1ubuntu1) ...
Removing mysql-server-5.5 (5.5.35+dfsg-1ubuntu1) ...
Removing mysql-server-core-5.5 (5.5.35+dfsg-1ubuntu1) ...
Removing libaio1:armhf (0.3.109-4) ...
Removing mysql-client-5.5 (5.5.35+dfsg-1ubuntu1) ...
Removing libdbd-mysql-perl (4.025-1) ...
Removing libdbi-perl (1.630-1) ...
Removing libterm-readkey-perl (2.31-1) ...
Removing mysql-client-core-5.5 (5.5.35+dfsg-1ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...

root@odroid1:~# aptitude remove -y apache2 apache2-mpm-prefork libapache2-mod-php5;
...
WARN: /etc is group writable!
WARN: /etc/default is group writable!
...

## TODO: fix group permissions of /etc and /etc/default

root@odroid1:~# netstat -natup;
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2221/sshd      
tcp        0      0 192.168.100.101:22      192.168.100.100:38672   ESTABLISHED 6864/0         
tcp6       0      0 :::22                   :::*                    LISTEN      2221/sshd 

root@odroid1:~# free -m;
             total       used       free     shared    buffers     cached
Mem:          1983        453       1529          0         19        360
-/+ buffers/cache:         73       1909
Swap:            0          0          0

root@odroid1:~# history -w;

root@odroid1:~# sleep 4 && sync && reboot;

$ ping 192.168.100.101;
PING 192.168.100.101 (192.168.100.101) 56(84) bytes of data.
From 192.168.100.100 icmp_seq=1 Destination Host Unreachable
From 192.168.100.100 icmp_seq=2 Destination Host Unreachable
...
From 192.168.100.100 icmp_seq=40 Destination Host Unreachable
From 192.168.100.100 icmp_seq=41 Destination Host Unreachable
From 192.168.100.100 icmp_seq=42 Destination Host Unreachable
From 192.168.100.100 icmp_seq=43 Destination Host Unreachable
From 192.168.100.100 icmp_seq=44 Destination Host Unreachable
64 bytes from 192.168.100.101: icmp_seq=45 ttl=64 time=1002 ms
64 bytes from 192.168.100.101: icmp_seq=46 ttl=64 time=2.98 ms
64 bytes from 192.168.100.101: icmp_seq=47 ttl=64 time=0.486 ms
64 bytes from 192.168.100.101: icmp_seq=48 ttl=64 time=0.477 ms
64 bytes from 192.168.100.101: icmp_seq=49 ttl=64 time=0.544 ms
64 bytes from 192.168.100.101: icmp_seq=50 ttl=64 time=0.572 ms
64 bytes from 192.168.100.101: icmp_seq=51 ttl=64 time=0.590 ms
64 bytes from 192.168.100.101: icmp_seq=52 ttl=64 time=0.436 ms
64 bytes from 192.168.100.101: icmp_seq=53 ttl=64 time=0.531 ms
64 bytes from 192.168.100.101: icmp_seq=54 ttl=64 time=0.478 ms
64 bytes from 192.168.100.101: icmp_seq=55 ttl=64 time=0.522 ms
64 bytes from 192.168.100.101: icmp_seq=56 ttl=64 time=0.461 ms
^C
--- 192.168.100.101 ping statistics ---
56 packets transmitted, 12 received, +44 errors, 78% packet loss, time 55011ms
rtt min/avg/max/mdev = 0.436/84.243/1002.840/276.968 ms, pipe 4

$ ssh -2 -C -p 22 root@odroid1;
root@odroid1's password:
Welcome to Ubuntu 14.04 (GNU/Linux 4.2.0-rc1-48 armv7l)

* Documentation:  https://help.ubuntu.com/
Last login: Sat Jan  1 12:00:12 2000

root@odroid1:~# uname -a;
Linux odroid1.odroids.local 4.2.0-rc1-48 #26 SMP PREEMPT Tue Aug 11 11:43:35 KST 2015 armv7l armv7l armv7l GNU/Linux

root@odroid1:~# uptime;
12:01:30 up 1 min,  2 users,  load average: 0.10, 0.04, 0.02

root@odroid1:~# grep -c -- '^processor' /proc/cpuinfo;
8
root@odroid1:~# grep -- '^model name' /proc/cpuinfo | sort | uniq -c;
      8 model name      : ARMv7 Processor rev 3 (v7l)
root@odroid1:~# grep -- '^BogoMIPS' /proc/cpuinfo | sort | uniq -c;
      4 BogoMIPS        : 120.00
      4 BogoMIPS        : 84.00

$ showtemp;
...


#################################################
## eMMC Storage I/O FIO Benchmark

root@odroid1:~# screen -R -D;

root@odroid1:~# dmesg | tail -n4;
[    7.137395] init: tty1 main process (2296) killed by TERM signal
[    7.144501] init: auto-serial-console respawning too fast, stopped
[    9.330908] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[  795.850870] EXT4-fs (mmcblk1): mounted filesystem with ordered data mode. Opts: (null)

root@odroid1:~# df -Th | grep -- 'mmc';
/dev/mmcblk0p2 ext4      7.5G  635M  6.6G   9% /
/dev/mmcblk0p1 vfat       32M   27M  5.3M  84% /boot

root@odroid1:~# ls -ltr /dev/disk/by-id/ | grep -- 'mmcblk0$';
lrwxrwxrwx 1 root root 13 Jan  1  2000 mmc-SU64G_0x101ffb35 -> ../../mmcblk0

root@odroid1:~# ls -ltr /dev/disk/by-id/ | grep -- 'mmcblk1$';
lrwxrwxrwx 1 root root 13 Jan  1  2000 mmc-064GE2_0xde70c8b3 -> ../../mmcblk1

## 64 GiB microsd card
root@odroid1:~# blockdev --getsize64 '/dev/disk/by-id/mmc-SU64G_0x101ffb35';
63864569856

## 64 GiB emmc card
root@odroid1:~# blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
62537072640

## man dd: BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000,
## M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

## no partition table for easier block alignment.
root@odroid1:~# sleep 4 && dd if='/dev/zero' of='/dev/disk/by-id/mmc-064GE2_0xde70c8b3' bs='1M' count='64' conv='fsync';
67108864 bytes (67 MB) copied, 3.51893 s, 19.1 MB/s

root@odroid1:~# partprobe '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';

root@odroid1:~# parted '/dev/disk/by-id/mmc-064GE2_0xde70c8b3' unit mib print free;
Model: MMC 064GE2 (sd/mmc)
Disk /dev/mmcblk1: 59640MiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start    End       Size      Type  File system  Flags
        0.03MiB  59640MiB  59640MiB        Free Space

root@odroid1:~# time mkfs.ext4 -L 'benchmark' -b 4096 -m0 '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';

root@odroid1:~# mount '/dev/disk/by-id/mmc-064GE2_0xde70c8b3' /mnt/;

root@odroid1:~# df -Th /mnt/;
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/mmcblk1   ext4   58G   52M   58G   1% /mnt

root@odroid1:~# time ( dd if='/dev/zero' of='/mnt/zero.dmp' bs='1M'; sync );
dd: error writing ‘/mnt/zero.dmp’: No space left on device
58509+0 records in
58508+0 records out
61350375424 bytes (61 GB) copied, 3523 s, 17.4 MB/s

real    58m48.614s
user    0m0.640s
sys     5m31.785s

root@odroid1:~# watch df -Th \| grep -- 'mmc';

root@odroid1:~# watch dmesg \| tail -n4;

root@odroid1:~# sync;
root@odroid1:~# rm -i /mnt/zero.dmp;
root@odroid1:~# sync;

root@odroid1:~# aptitude install -y 'sysstat';
...

root@odroid1:~# aptitude install -y 'fio';
The following NEW packages will be installed:
  fio libaio1{a} libibverbs1{a} librdmacm1{a}
0 packages upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
Need to get 303 kB of archives. After unpacking 1039 kB will be used.
Get: 1 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libaio1 armhf 0.3.109-4 [6102 B]
Get: 2 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libibverbs1 armhf 1.1.7-1ubuntu1 [20.0 kB]
Get: 3 http://ports.ubuntu.com/ubuntu-ports/ trusty/main librdmacm1 armhf 1.0.16-1 [29.8 kB]
Get: 4 http://ports.ubuntu.com/ubuntu-ports/ trusty/universe fio armhf 2.1.3-1 [247 kB]
Fetched 303 kB in 2min 15s (2230 B/s)                                                                                                   
Selecting previously unselected package libaio1:armhf.
(Reading database ... 23107 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_armhf.deb ...
Unpacking libaio1:armhf (0.3.109-4) ...
Selecting previously unselected package libibverbs1.
Preparing to unpack .../libibverbs1_1.1.7-1ubuntu1_armhf.deb ...
Unpacking libibverbs1 (1.1.7-1ubuntu1) ...
Selecting previously unselected package librdmacm1.
Preparing to unpack .../librdmacm1_1.0.16-1_armhf.deb ...
Unpacking librdmacm1 (1.0.16-1) ...
Selecting previously unselected package fio.
Preparing to unpack .../archives/fio_2.1.3-1_armhf.deb ...
Unpacking fio (2.1.3-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libaio1:armhf (0.3.109-4) ...
Setting up libibverbs1 (1.1.7-1ubuntu1) ...
Setting up librdmacm1 (1.0.16-1) ...
Setting up fio (2.1.3-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...

root@odroid1:~# fio --version;
fio-2.1.3

root@odroid1:~# fio --help;
fio-2.1.3
fio [options] [job options] <job file(s)>
  --debug=options       Enable debug logging. May be one/more of:
                        process,file,io,mem,blktrace,verify,random,parse,
                        diskutil,job,mutex,profile,time,net
  --parse-only          Parse options only, don't start any IO
  --output              Write output to file
  --runtime             Runtime in seconds
  --latency-log         Generate per-job latency logs
  --bandwidth-log       Generate per-job bandwidth logs
  --minimal             Minimal (terse) output
  --output-format=x     Output format (terse,json,normal)
  --terse-version=x     Set terse version output format to 'x'
  --version             Print version info and exit
  --help                Print this page
  --cpuclock-test       Perform test/validation of CPU clock
  --cmdhelp=cmd         Print command help, "all" for all of them
  --enghelp=engine      Print ioengine help, or list available ioengines
  --enghelp=engine,cmd  Print help for an ioengine cmd
  --showcmd             Turn a job file into command line options
  --eta=when            When ETA estimate should be printed
                        May be "always", "never" or "auto"
  --eta-newline=time    Force a new line for every 'time' period passed
  --status-interval=t   Force full status dump every 't' period passed
  --readonly            Turn on safety read-only checks, preventing writes
  --section=name        Only run specified section in job file
  --alloc-size=kb       Set smalloc pool to this size in kb (def 1024)
  --warnings-fatal      Fio parser warnings are fatal
  --max-jobs=nr         Maximum number of threads/processes to support
  --server=args         Start a backend fio server
  --daemonize=pidfile   Background fio server, write pid to file
  --client=hostname     Talk to remote backend fio server at hostname
  --idle-prof=option    Report cpu idleness on a system or percpu basis
                        (option=system,percpu) or run unit work
                        calibration only (option=calibrate)

Fio was written by Jens Axboe <jens.axboe@oracle.com>
                   Jens Axboe <jaxboe@fusionio.com>

root@odroid1:~# cd /mnt/
root@odroid1:/mnt# df -Th .;
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/mmcblk1   ext4   58G   52M   58G   1% /mnt

## 4 jobs with 4 GiB each == 16 GiB storage workload.
root@odroid1:/mnt# cat > random-rw-8kb-4g.fio << EOF
[random-rw-8kb-4g]
rw=randrw
ioengine=sync
size=4g
blocksize=8k
numjobs=4
nrfiles=4
iodepth=64
direct=1
directory=`pwd`
group_reporting
loops=1
EOF

root@odroid1:/mnt# cat 'random-rw-8kb-4g.fio';
[random-rw-8kb-4g]
rw=randrw
ioengine=sync
size=4g
blocksize=8k
numjobs=4
nrfiles=4
iodepth=64
direct=1
directory=/mnt
group_reporting
loops=1

root@odroid1:~# find '/sys/devices/platform/' -iname 'queue';
/sys/devices/platform/12220000.mmc:/mmc_host/mmc1/mmc1:e624/block/mmcblk0/queue
/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/queue
/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/mmcblk1rpmb/queue
/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/mmcblk1boot0/queue
/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/mmcblk1boot1/queue

root@odroid1:~# cat '/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/queue/scheduler';
noop deadline [cfq]

root@odroid1:~# cat '/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/queue/iosched/low_latency';
1

root@odroid1:~# cat /proc/sys/fs/mqueue/queues_max;
256
root@odroid1:~# cat /proc/sys/fs/mqueue/msgsize_max;
8192
root@odroid1:~# cat /proc/sys/fs/mqueue/msgsize_default;
8192

root@odroid1:~# echo "$(( 1024 * 2048 / 256 )) average block size in kbyte in 256 mqueues";
8192 average block size in kbyte in 256 mqueues

root@odroid1:/mnt# rm -v random-rw-8kb-4g.[0-9]*; sync;

####################################
## Single 64 GiB eMMC v5.0 Card:
## 8 kiB RANDOM R/W I/O LATENCY + IOPS BENCHMARK + CFQ Scheduler:
## 3 MiB/s random r/w, 400 IOPS, 5 ms average latency, 90% <= 10 ms.

root@odroid1:/mnt# time fio 'random-rw-8kb-4g.fio';
root@odroid1:/mnt# time fio 'random-rw-8kb-4g.fio';
random-rw-8kb-4g: (g=0): rw=randrw, bs=8K-8K/8K-8K/8K-8K, ioengine=sync, iodepth=64
...
random-rw-8kb-4g: (g=0): rw=randrw, bs=8K-8K/8K-8K/8K-8K, ioengine=sync, iodepth=64
fio-2.1.3
Starting 4 processes
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
Jobs: 1 (f=4): [_m__] [99.9% done] [5082KB/5114KB/0KB /s] [635/639/0 iops] [eta 00m:02s]]
random-rw-8kb-4g: (groupid=0, jobs=4): err= 0: pid=2536: Sat Jan  1 13:04:58 2000
  read : io=5280.0KB, bw=3231.6KB/s, iops=403, runt=2597877msec
    clat (usec): min=581, max=10022K, avg=4222.33, stdev=50567.39
     lat (usec): min=582, max=10022K, avg=4223.55, stdev=50567.39
    clat percentiles (usec):
     |  1.00th=[ 1096],  5.00th=[ 1176], 10.00th=[ 1272], 20.00th=[ 1576],
     | 30.00th=[ 1720], 40.00th=[ 1784], 50.00th=[ 1848], 60.00th=[ 1928],
     | 70.00th=[ 2008], 80.00th=[ 3600], 90.00th=[ 4704], 95.00th=[14272],
     | 99.00th=[37632], 99.50th=[43264], 99.90th=[70144], 99.95th=[80384],
     | 99.99th=[2965504]
    bw (KB  /s): min=    0, max= 5168, per=28.92%, avg=934.38, stdev=696.72
  write: io=4090.9MB, bw=3226.2KB/s, iops=403, runt=2597877msec
    clat (usec): min=608, max=8106.2K, avg=5411.91, stdev=52374.61
     lat (usec): min=610, max=8106.2K, avg=5413.98, stdev=52374.60
    clat percentiles (usec):
     |  1.00th=[  956],  5.00th=[ 1032], 10.00th=[ 1144], 20.00th=[ 1448],
     | 30.00th=[ 1592], 40.00th=[ 1656], 50.00th=[ 1736], 60.00th=[ 1832],
     | 70.00th=[ 1992], 80.00th=[ 3824], 90.00th=[13760], 95.00th=[25984],
     | 99.00th=[44288], 99.50th=[54016], 99.90th=[81408], 99.95th=[93696],
     | 99.99th=[3489792]
    bw (KB  /s): min=    1, max= 5216, per=28.95%, avg=933.84, stdev=697.23
    lat (usec) : 750=0.13%, 1000=1.57%
    lat (msec) : 2=68.28%, 4=13.64%, 10=8.26%, 20=3.06%, 50=4.61%
    lat (msec) : 100=0.42%, 250=0.01%, 500=0.01%, 750=0.01%, 1000=0.01%
    lat (msec) : 2000=0.01%, >=2000=0.01%
  cpu          : usr=0.13%, sys=1.07%, ctx=2101366, majf=0, minf=58
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=1049236/w=1047916/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
   READ: io=8197.2MB, aggrb=3231KB/s, minb=3231KB/s, maxb=3231KB/s, mint=2597877msec, maxt=2597877msec
  WRITE: io=8186.9MB, aggrb=3226KB/s, minb=3226KB/s, maxb=3226KB/s, mint=2597877msec, maxt=2597877msec

Disk stats (read/write):
  mmcblk1: ios=1049195/1048897, merge=0/1017, ticks=4400645/5750720, in_queue=10148640, util=100.00%

real    58m50.990s
user    0m23.500s 
sys     3m20.260s 


####################################
## Single 64 GiB eMMC v5.0 Card:
## 8 kiB RANDOM R/W I/O LATENCY + IOPS BENCHMARK + Deadline Scheduler + MQUEUE:
## 3 MiB/s random r/w, 400 IOPS, 3.6 ms average latency, 90% <= 10 ms.

## I/O Hardware Multi Queueing
## if your attached storage supports multi queueing in hardware, your kernel should support and use storage mqueue.
root@odroid1:~# cat '/sys/module/scsi_mod/parameters/use_blk_mq';
N
## TODO: persist this setting in sysctl.conf if the eMMC card properly manages parallelism.
root@odroid1:~# echo Y > '/sys/module/scsi_mod/parameters/use_blk_mq';
root@odroid1:~# cat '/sys/module/scsi_mod/parameters/use_blk_mq';
Y
## most recent linux kernels support I/O elevators for mqueue as well.
root@odroid1:~# cat '/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/queue/scheduler';
noop deadline [cfq]
## TODO: persist this setting in sysctl.conf to reduce I/O latency spread on random R/W I/O.
root@odroid1:~# echo 'deadline' > '/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/queue/scheduler';
root@odroid1:~# cat '/sys/devices/platform/12200000.mmc:/mmc_host/mmc0/mmc0:0001/block/mmcblk1/queue/scheduler';
noop [deadline] cfq

root@odroid1:/mnt# rm -v random-rw-8kb-4g.[0-9]*; sync;

root@odroid1:/mnt# time fio 'random-rw-8kb-4g.fio';
random-rw-8kb-4g: (g=0): rw=randrw, bs=8K-8K/8K-8K/8K-8K, ioengine=sync, iodepth=64
...
random-rw-8kb-4g: (g=0): rw=randrw, bs=8K-8K/8K-8K/8K-8K, ioengine=sync, iodepth=64
fio-2.1.3
Starting 4 processes
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
random-rw-8kb-4g: Laying out IO file(s) (4 file(s) / 4096MB)
Jobs: 1 (f=4): [m___] [99.9% done] [728KB/768KB/0KB /s] [91/96/0 iops] [eta 00m:03s]    ]
random-rw-8kb-4g: (groupid=0, jobs=4): err= 0: pid=2840: Sat Jan  1 14:29:51 2000
  read : io=5280.0KB, bw=3182.2KB/s, iops=397, runt=2637798msec
    clat (usec): min=549, max=111964, avg=3660.52, stdev=6179.17
     lat (usec): min=551, max=111966, avg=3661.71, stdev=6179.17
    clat percentiles (usec):
     |  1.00th=[  812],  5.00th=[ 1208], 10.00th=[ 1336], 20.00th=[ 1736],
     | 30.00th=[ 1848], 40.00th=[ 1976], 50.00th=[ 2160], 60.00th=[ 2320],
     | 70.00th=[ 2416], 80.00th=[ 2576], 90.00th=[ 4832], 95.00th=[14912],
     | 99.00th=[36096], 99.50th=[40704], 99.90th=[52992], 99.95th=[61184],
     | 99.99th=[75264]
    bw (KB  /s): min=   15, max= 5696, per=25.90%, avg=824.24, stdev=567.16
  write: io=4090.9MB, bw=3178.2KB/s, iops=397, runt=2637798msec
    clat (usec): min=568, max=147226, avg=6105.79, stdev=10213.19
     lat (usec): min=570, max=147229, avg=6107.82, stdev=10213.20
    clat percentiles (usec):
     |  1.00th=[  748],  5.00th=[ 1496], 10.00th=[ 1864], 20.00th=[ 2096],
     | 30.00th=[ 2192], 40.00th=[ 2320], 50.00th=[ 2480], 60.00th=[ 2800],
     | 70.00th=[ 3152], 80.00th=[ 3952], 90.00th=[18816], 95.00th=[30080],
     | 99.00th=[48896], 99.50th=[58112], 99.90th=[75264], 99.95th=[81408],
     | 99.99th=[98816]
    bw (KB  /s): min=   31, max= 6032, per=25.90%, avg=823.09, stdev=563.29
    lat (usec) : 750=0.78%, 1000=0.93%
    lat (msec) : 2=26.20%, 4=57.01%, 10=5.61%, 20=3.02%, 50=5.94%
    lat (msec) : 100=0.51%, 250=0.01%
  cpu          : usr=0.13%, sys=0.94%, ctx=2101016, majf=0, minf=59
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=1049236/w=1047916/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
   READ: io=8197.2MB, aggrb=3182KB/s, minb=3182KB/s, maxb=3182KB/s, mint=2637798msec, maxt=2637798msec
  WRITE: io=8186.9MB, aggrb=3178KB/s, minb=3178KB/s, maxb=3178KB/s, mint=2637798msec, maxt=2637798msec

Disk stats (read/write):
  mmcblk1: ios=1049165/1048880, merge=0/1044, ticks=3817310/6384185, in_queue=10200060, util=100.00%

real    75m44.381s
user    0m27.575s 
sys     2m58.980s 

## verdict: for eMMC switching from single queue to multi queue does not make that much a difference,
## except for the standard deviation that shrinked from 50 ms with cfq+sq to 6 ms with deadline+mq.


####################################
## Single 64 GiB eMMC v5.0 Card: sequential reads + writes: 180 MiB/s + 20 MiB/s.
## TODO: benchmark


#################################################
## Ceph Installation

root@odroid1:~# screen -R -D;

root@odroid1:~# aptitude search 'ceph';
p   ceph                                                         - distributed storage and file system                                  
p   ceph-common                                                  - common utilities to mount and interact with a ceph storage cluster   
p   ceph-common-dbg                                              - debugging symbols for ceph-common                                    
p   ceph-dbg                                                     - debugging symbols for ceph                                           
p   ceph-deploy                                                  - Deployment and configuration of Ceph.                                
p   ceph-fs-common                                               - common utilities to mount and interact with a ceph file system       
p   ceph-fs-common-dbg                                           - debugging symbols for ceph-fs-common                                 
p   ceph-mds                                                     - metadata server for the ceph distributed file system                 
p   ceph-mds-dbg                                                 - debugging symbols for ceph-mds                                       
p   ceph-resource-agents                                         - OCF-compliant resource agents for Ceph                               
p   ceph-test                                                    - Ceph test and benchmarking tools                                     
p   ceph-test-dbg                                                - Debugging symbols for ceph-test                                      
p   libcephfs-dev                                                - Ceph distributed file system client library (development files)      
p   libcephfs-java                                               - Java library for the Ceph File System                                
p   libcephfs-jni                                                - Java Native Interface library for CephFS Java bindings               
p   libcephfs-jni-dbg                                            - Debugging symbols for libcephfs-jni                                  
p   libcephfs1                                                   - Ceph distributed file system client library                          
p   libcephfs1-dbg                                               - debugging symbols for libcephfs1                                     
p   python-ceph                                                  - Python libraries for the Ceph distributed filesystem                 
v   python2.7-ceph                                               -    

root@odroid1:~# aptitude install ceph ceph-deploy;
The following NEW packages will be installed:
  binutils{a} ceph ceph-common{a} ceph-deploy cryptsetup-bin{a} gdisk{a} libaio1{a} libboost-system1.54.0{a}
  libboost-thread1.54.0{a} libcephfs1{a} libcryptsetup4{a} libgoogle-perftools4{a} libicu52{a} libjs-jquery{a} libleveldb1{a}
  libnspr4{a} libnss3{a} libnss3-nssdb{a} librados2{a} librbd1{a} libreadline5{a} libsnappy1{a} libtcmalloc-minimal4{a}
  python-blinker{a} python-ceph{a} python-flask{a} python-itsdangerous{a} python-jinja2{a} python-markupsafe{a} python-openssl{a}
  python-pkg-resources{a} python-pyinotify{a} python-werkzeug{a} xfsprogs{a}
0 packages upgraded, 34 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.3 MB of archives. After unpacking 93.1 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ports.ubuntu.com/ubuntu-ports/ trusty/main binutils armhf 2.24-5ubuntu3 [2002 kB]
Get: 2 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libboost-system1.54.0 armhf 1.54.0-4ubuntu3 [9816 B]
Get: 3 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libboost-thread1.54.0 armhf 1.54.0-4ubuntu3 [23.0 kB]
Get: 4 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libnspr4 armhf 2:4.10.2-1ubuntu1 [89.1 kB]
Get: 5 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libnss3-nssdb all 2:3.15.4-1ubuntu7 [10.6 kB]
Get: 6 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libnss3 armhf 2:3.15.4-1ubuntu7 [899 kB]
Get: 7 http://ports.ubuntu.com/ubuntu-ports/ trusty/main librados2 armhf 0.79-0ubuntu1 [1253 kB]
Get: 8 http://ports.ubuntu.com/ubuntu-ports/ trusty/main librbd1 armhf 0.79-0ubuntu1 [285 kB]
Get: 9 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libcephfs1 armhf 0.79-0ubuntu1 [1333 kB]
Get: 10 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libjs-jquery all 1.7.2+dfsg-2ubuntu1 [78.8 kB]
Get: 11 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-werkzeug all 0.9.4+dfsg-1.1ubuntu1 [236 kB]
Get: 12 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-markupsafe armhf 0.18-1build2 [13.9 kB]
Get: 13 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-jinja2 all 2.7.2-2 [161 kB]
Get: 14 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-itsdangerous all 0.22+dfsg1-1build1 [11.5 kB]
Get: 15 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-flask all 0.10.1-2build1 [51.7 kB]
Get: 16 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-ceph armhf 0.79-0ubuntu1 [35.2 kB]
Get: 17 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libaio1 armhf 0.3.109-4 [6102 B]
Get: 18 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libtcmalloc-minimal4 armhf 2.1-2ubuntu1 [90.3 kB]
Get: 19 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libgoogle-perftools4 armhf 2.1-2ubuntu1 [152 kB]
Get: 20 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libsnappy1 armhf 1.1.0-1ubuntu1 [10.2 kB]
Get: 21 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libleveldb1 armhf 1.15.0-2 [105 kB]
Get: 22 http://ports.ubuntu.com/ubuntu-ports/ trusty/main ceph-common armhf 0.79-0ubuntu1 [4334 kB]
Get: 23 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libcryptsetup4 armhf 2:1.6.1-1ubuntu1 [68.9 kB]
Get: 24 http://ports.ubuntu.com/ubuntu-ports/ trusty/main cryptsetup-bin armhf 2:1.6.1-1ubuntu1 [75.4 kB]
Get: 25 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libicu52 armhf 52.1-3 [6535 kB]
Get: 26 http://ports.ubuntu.com/ubuntu-ports/ trusty/main gdisk armhf 0.8.8-1build1 [177 kB]
Get: 27 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libreadline5 armhf 5.2+dfsg-2 [106 kB]
Get: 28 http://ports.ubuntu.com/ubuntu-ports/ trusty/main xfsprogs armhf 3.1.9ubuntu2 [462 kB]
Get: 29 http://ports.ubuntu.com/ubuntu-ports/ trusty/main ceph armhf 0.79-0ubuntu1 [4431 kB]
Get: 30 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-pkg-resources all 3.3-1ubuntu1 [61.9 kB]
Get: 31 http://ports.ubuntu.com/ubuntu-ports/ trusty/universe ceph-deploy all 1.4.0-0ubuntu1 [73.4 kB]
Get: 32 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-blinker all 1.3.dfsg1-1ubuntu2 [29.8 kB]
Get: 33 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-openssl armhf 0.13-2ubuntu6 [74.1 kB]
Get: 34 http://ports.ubuntu.com/ubuntu-ports/ trusty/main python-pyinotify all 0.9.4-1build1 [24.5 kB]
Fetched 23.3 MB in 4min 58s (78.2 kB/s)
Extracting templates from packages: 100%
Selecting previously unselected package binutils.
(Reading database ... 21470 files and directories currently installed.)
Preparing to unpack .../binutils_2.24-5ubuntu3_armhf.deb ...
Unpacking binutils (2.24-5ubuntu3) ...
...

root@odroid1:~# sync;


#################################################
## Backup Odroid XU4 Boot Image

## you might want to first shrink the ext4 rootfs file system and the rootfs dos partition for smaller sized micro-sdcards.

## shrink the rootfs (on the 2nd and last partition).
$ resize2fs '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part2' 'XXXXXXX';

## shrink the rootfs partition to the same size.
$ parted '/dev/disk/by-id/mmc-SU64G_0x101ffb35' unit mib print free;
$ parted '/dev/disk/by-id/mmc-SU64G_0x101ffb35' 'resizepart 2 8192MiB';
$ parted '/dev/disk/by-id/mmc-SU64G_0x101ffb35' unit mib print free;
Model: SD SU64G (sd/mmc)
Disk /dev/mmcblk0: 60906MiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start    End       Size      Type     File system  Flags
        0.03MiB  1.00MiB   0.97MiB            Free Space
1      1.00MiB  33.0MiB   32.0MiB   primary  fat16        lba
2      33.0MiB  8192MiB   8159MiB   primary  ext4
        8192MiB  60906MiB  52714MiB           Free Space

## you might want to first adapt the autogenerated udev persistent network interface rules for your MACs now.
## (remove any previous mapping, or add all the proper mappings for all the odroid-xu4 MACs you already know.)
$ grep -- '^SUBSYSTEM' '/run/media/anonymous/rootfs/etc/udev/rules.d/70-persistent-net.rules';
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:30:00:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
$ grep --color -- 'ATTR{address}==\([^ ]*\) ' '/run/media/anonymous/rootfs/etc/udev/rules.d/70-persistent-net.rules';
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:06:30:00:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
$ vim '/run/media/anonymous/rootfs/etc/udev/rules.d/70-persistent-net.rules';

$ df -Th | grep -- 'mmc';
/dev/mmcblk0p2          ext4      7.5G  541M  6.7G   8% /run/media/anonymous/rootfs
/dev/mmcblk0p1          vfat       32M   27M  5.3M  84% /run/media/anonymous/BOOT

## man dd: BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000,
## M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

$ sleep 4 && dd if='/dev/zero' of='/run/media/anonymous/BOOT/zero.dmp' bs='1M'; sync;
5464064 bytes (5.5 MB) copied, 0.0280548 s, 195 MB/s

$ rm -v '/run/media/anonymous/BOOT/zero.dmp';

$ sleep 4 && dd if='/dev/zero' of='/run/media/anonymous/rootfs/zero.dmp' bs='1M'; sync;
7340437504 bytes (7.3 GB) copied, 127.999 s, 57.3 MB/s

$ rm -v '/run/media/anonymous/rootfs/zero.dmp';

$ umount /run/media/*/{BOOT,rootfs}/;            

$ df -Th | grep -- 'mmc';

$ sync;

$ fsck.vfat -a -w '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part1';
$ fsck.ext4 -f -v -D '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part2';

## man dd: BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000,
## M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

## backup
$ sleep 4 && dd if='/dev/disk/by-id/mmc-SU64G_0x101ffb35' of='ubuntu-14_04-odroidxu4-enc.img' bs='1M' count='8192';
8589934592 bytes (8.6 GB) copied, 123.838 s, 69.4 MB/s

$ du -m 'ubuntu-14_04-odroidxu4-enc.img';
8193    ubuntu-14_04-odroidxu4-enc.img

$ echo "$(( 1000 * 8589934592 / 1024 / 1024 ))";
8192000

$ time xz -z -6 -T4 -k 'ubuntu-14_04-odroidxu4-enc.img';
real    3m53.922s
user    13m43.945s
sys     0m4.068s

$ du -m 'ubuntu-14_04-odroidxu4-enc.img.xz';
564     ubuntu-14_04-odroidxu4-enc.img.xz


#################################################
## Restore Odroid XU4 Boot Image

## man dd: BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000,
## M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

## restore
$ sleep 4 && dd if='ubuntu-14_04-odroidxu4-enc.img' of='/dev/disk/by-id/mmc-SS08G_0x1925aff8' bs='1M' conv='fsync'; sync;

$ sleep 4 && dd if='ubuntu-14_04-odroidxu4-enc.img' of='/dev/disk/by-id/mmc-SU64G_0x101ffb35' bs='1M' conv='fsync'; sync;
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB) copied, 218.144 s, 39.4 MB/s

$ partprobe '/dev/disk/by-id/mmc-SU64G_0x101ffb35';

$ fsck.vfat -a -w '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part1';
fsck.fat 3.0.27 (2014-11-12)
/dev/disk/by-id/mmc-SU64G_0x101ffb35-part1: 18 files, 13675/16343 clusters

$ fsck.ext4 -y -f -v -D '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part2';

$ resize2fs '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part2' 'XXXXXXX';

$ fsck.ext4 -f -v -D '/dev/disk/by-id/mmc-SU64G_0x101ffb35-part2';
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

rootfs: ***** FILE SYSTEM WAS MODIFIED *****

       26302 inodes used (5.71%, out of 460672)
           7 non-contiguous files (0.0%)
           6 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 22568/2
      171353 blocks used (8.60%, out of 1991552)
           0 bad blocks
           1 large file

       19923 regular files
        2503 directories
          56 character device files
          25 block device files
           0 fifos
          16 links
        3786 symbolic links (3643 fast symbolic links)
           0 sockets
------------
       26309 files

## do not forget to adapt the autogenerated udev persistent network interface rules for your MACs.


#################################################
## Ceph Bootstrap

root@odroid1:~# screen -R -D;

root@odroid1:~# ceph-deploy --help;
usage: ceph-deploy [-h] [-v | -q] [--version] [--username USERNAME]
                   [--overwrite-conf] [--cluster NAME]
                   COMMAND ...

Easy Ceph deployment

  -^-
/   \
|O o|  ceph-deploy v1.4.0
).-.(
'/|||\`
| '|` |
  '|`

optional arguments:
  -h, --help           show this help message and exit
  -v, --verbose        be more verbose
  -q, --quiet          be less verbose
  --version            the current installed version of ceph-deploy
  --username USERNAME  the username to connect to the remote host
  --overwrite-conf     overwrite an existing conf file on remote host (if
                       present)
  --cluster NAME       name of the cluster

commands:
  COMMAND              description
    new                Start deploying a new cluster, and write a CLUSTER.conf
                       and keyring for it.
    install            Install Ceph packages on remote hosts.
    mds                Deploy ceph MDS on remote hosts.
    mon                Deploy ceph monitor on remote hosts.
    gatherkeys         Gather authentication keys for provisioning new nodes.
    disk               Manage disks on a remote host.
    osd                Prepare a data disk on remote host.
    admin              Push configuration and client.admin key to a remote
                       host.
    config             Push configuration file to a remote host.
    uninstall          Remove Ceph packages from remote hosts.
    purgedata          Purge (delete, destroy, discard, shred) any Ceph data
                       from /var/lib/ceph
    purge              Remove Ceph packages from remote hosts and purge all
                       data.
    forgetkeys         Remove authentication keys from the local directory.
    pkg                Manage packages on remote hosts.

root@odroid1:~# cat /etc/hosts;
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       odroid1.odroids.local odroid1
192.168.100.101 odroid1.odroids.local odroid1

root@odroid1:~# ceph-deploy forgetkeys;
[ceph_deploy.cli][INFO  ] Invoked (1.4.0): /usr/bin/ceph-deploy forgetkeys

root@odroid1:~# ceph-deploy disk list 'odroid1';
[ceph_deploy.cli][INFO  ] Invoked (1.4.0): /usr/bin/ceph-deploy disk list odroid1
[ceph_deploy][ERROR ] ConfigError: Cannot load config: [Errno 2] No such file or directory: 'ceph.conf'

root@odroid1:~# ls -l '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
lrwxrwxrwx 1 root root 13 Jan  1 12:00 /dev/disk/by-id/mmc-064GE2_0xde70c8b3 -> ../../mmcblk1
root@odroid1:~# blockdev --getsize64 '/dev/disk/by-id/mmc-064GE2_0xde70c8b3';
62537072640

## TODO: setup >= 3 odroid-xu4 and use the ceph-deploy tool to setup a ceph cluster with 3x OSDs and 3x MONs.
## https://matrix-universe.eu/drupal7/?q=cookbooks/ceph/ceph-manage_osd_nodes


#################################################
## TODO: ADB via WIFI for Serial Console Access

## apparently there is no more USB->UART console access for the XU4 anymore.
## so you have to use the Android project's 'adb' tool via wifi to access the system console.
## http://odroid.com/dokuwiki/doku.php?id=en:usb_uart_kit

## "Install Android Tools (ADB & Fastboot)"
## http://odroid.com/dokuwiki/doku.php?id=en:adb_fastboot_install

## eof

.

.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.