Howto Anleitung zur Auslagerung des Rootfs von SD-Card auf HDD/SSD 2015 Stefan W. Lambert kontakt@stefanius.de
Copyright-Hinweis Dieses Dokument obliegt den Bestimmungen der GNU-Lizenz für freie Dokumentation (GNU Free Documentation License Version 1.2) und darf unter Beachtung der Bestimmungen dieser Lizenz frei genutzt werden. Haftungsausschluß Die Nutzung dieses Dokumentes erfolgt auf eigene Gefahr. Der Autor übernimmt keinerlei Haftung für Schäden, die durch die Verwendung des Dokumentes entstehen. Ebenso übernimmt der Autor keinerlei Haftung für inhaltliche oder fachliche Mängel des Dokumentes Autor Stefan W. Lambert kontakt@stefanius.de Stand: 26.10.15 - Seite 2 - Ersteller: Stefan W. Lambert
Inhaltsverzeichnis 0. Vorbemerkung...5 1. Rootfs von SD-Card auf HDD/SSD auslagern...6 Stand: 26.10.15 - Seite 3 - Ersteller: Stefan W. Lambert
Stand: 26.10.15 - Seite 4 - Ersteller: Stefan W. Lambert
0. Vorbemerkung Dieses Dokument beschreibt die notwendigen Arbeitsschritte zum Auslagern des Rootfs von SD-Card auf eine HDD/SSD. Die Anleitung wurde für OdroidNAS SD-Card Image erstellt, sie ist jedoch auch für die von mir entwickelten SD-Card Images mit grafischer Benutzeroberfläche gültig. Stand: 26.10.15 - Seite 5 - Ersteller: Stefan W. Lambert
1.Rootfs auf HDD/SSD auslagern Die Odroid XU3/XU4 Einplatinencomputer verfügen zwar über USB 2.0 Schittstellen, aufgrund der Geschwindigkeitsvorteile empfehle ich jedoch die Verwendung einer USB 3.0 Festplatte am USB 3.0 Port des Odroid XU3/XU4. Schritt 1 Ausgeschaltete USB3.0 HDD/SSD am ausgeschaltetem OdroidNAS anschließen Schritt 2 USB3.0 HDD/SDD starten und warten bis sie bereit ist Schritt 3 OdroidNAS starten, anmelden (bevorzugt an der Konsole oder per ssh) und per 'sudo -i' zum Benutzer root wechseln Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.10.82 armv7l) * Documentation: https://help.ubuntu.com/ System information as of Tue Oct 13 18:37:19 CEST 2015 System load: 0.48 Processes: 158 Usage of /: 82.4% of 1.94GB Users logged in: 1 Memory usage: 15% IP address for eth0: 192.168.2.5 Swap usage: 0% Graph this data and manage this system at: https://landscape.canonical.com/ No mail. Last login: Tue Oct 13 18:37:19 2015 odroid@odroidnas:~$ sudo -i [sudo] password for odroid: root@odroidnas:~# Stand: 26.10.15 - Seite 6 - Ersteller: Stefan W. Lambert
Schritt 4 Überprüfen ob die HDD/SSD verfügbar ist root@odroidnas:~# cat /proc/partitions major minor #blocks name 179 0 31166976 mmcblk0 179 1 65536 mmcblk0p1 179 2 31100416 mmcblk0p2 8 0 244198584 sda 8 1 244197560 sda1 Ist eine HDD/SSD vorhanden, hat diese immer 'sda' als Gerätebezeichnung. Eventuell vorhandene Partitionen sind durch sda gefolgt von einer Ziffer gekennzeichnet. In diesem Beispiel ist auf der Festplatte eine Partition (sda1) vorhanden. Schritt 5 Löschen der vorhandenen Festplattenpartition und anlegen einer neuen Festplattenpartition root@odroidnas:~# fdisk /dev/sda Command (m for help): d Selected partition 1 Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): <Bestätigen mit Eingabe-Taste> Using default value 1 First sector (2048-488397167, default 2048): <Bestätigen mit Eingabe-Taste> Using default value 2048 Last sector, +sectors or +size{k,m,g} (2048-488397167, default 488397167): <Bestätigen mit Eingabe-Taste> Using default value 488397167 Command (m for help): w Stand: 26.10.15 - Seite 7 - Ersteller: Stefan W. Lambert
Anmerkung: d = löschen der vorhandenen Partition (nur notwendig wenn bereits eine Partition vorhanden ist) n = Anlegen einer neuen Partion (alle Vorgaben mit <Eingabe> -Taste bestätigen) w= verlassen von fdisk und schreiben der neuen Partitionstabelle Schritt 6 Formatieren der Festplattenpartition mit dem Dateisystem ext4 root@odroidnas:~# mkfs.ext4 /dev/sda1 mke2fs 1.42.9 (4-Feb-2014) Dateisystem-Label=OS-Typ: Linux Blockgröße=4096 (log=2) Fragmentgröße=4096 (log=2) Stride=0 Blöcke, Stripebreite=0 Blöcke 15269888 Inodes, 61049390 Blöcke 3052469 Blöcke (5.00%) reserviert für den Superuser Erster Datenblock=0 Maximale Dateisystem-Blöcke=0 1864 Blockgruppen 32768 Blöcke pro Gruppe, 32768 Fragmente pro Gruppe 8192 Inodes pro Gruppe Superblock-Sicherungskopien gespeichert in den Blöcken: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Platz für Gruppentabellen wird angefordert: erledigt Inode-Tabellen werden geschrieben: erledigt Erstelle Journal (32768 Blöcke): erledigt Schreibe Superblöcke und Dateisystem-Accountinginformationen: erledigt Stand: 26.10.15 - Seite 8 - Ersteller: Stefan W. Lambert
Schritt 7 Anlegen von Verzeichnissen zum temporären Einhängen der Partitionen der SD- Karte und der HDD/SSD root@odroidnas:~# mkdir /tmp/sd1 root@odroidnas:~# mkdir /tmp/sd2 root@odroidnas:~# mkdir /tmp/hdd Schritt 8 Temporäres Einhängen der Partitionen der SD-Karte und der HDD/SSD root@odroidnas:~# mount -t vfat /dev/mmcblk0p1 /tmp/sd1 root@odroidnas:~# mount /dev/mmcblk0p2 /tmp/sd2 root@odroidnas:~# mount /dev/sda1 /tmp/hdd Schritt 9 Kopieren des Rootfs von der 2.Partition der SD-Karte auf die HDD/SSD root@odroidnas:~# (cd /tmp/sd2; tar --backup -c *) tar -C /tmp/hdd -xv Schritt 10 von der vorhandenen 'boot.ini'-datei auf der 1.Partition der SD-Card eine Sicherheitskopie erstellen root@odroidnas:~# cp /tmp/sd1/boot.ini /tmp/sd1/boot.ini.sdcard Schritt 11 Die UUID von '/dev/sda1' herausfinden root@odroidnas:~# blkid /dev/sda1 /dev/sda1: UUID="079eca2c-86a1-4ab2-9177-3da396661ad7" TYPE="ext4" Anmerkung; Die 'UUID' ist eine eindeutige Indentifikationsnummer für ein Linux-Dateisystem bzw. für einen Datenträger. Sie wird in Arbeitsschritt 12 in die Datei 'boot-ini' eingetragen Stand: 26.10.15 - Seite 9 - Ersteller: Stefan W. Lambert
Schritt 12 Die Datei 'boot.ini' editieren (UUID von /dev/sda1 eintragen) root@odroidnas:/tmp/sd1# nano /tmp/sd1/boot.ini Die 'boot.ini'-datei im Ursprungszustand: fodroidxu-uboot-config # U-Boot Parameters setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" # Mac address configuration (XU3) setenv macaddr "00:1e:06:61:7a:39" #---------------------------------------------------------------------------- -------------------------- # Basic Ubuntu Setup. Don't touch unless you know what you are doing. # -------------------------------- setenv bootrootfs "console=tty1 console=ttysac2,115200n8 root=uuid=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes" # boot commands 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" # --- Screen Configuration for HDMI --- # # --------------------------------------- # Uncomment only ONE line! Leave all commented for automatic selection. # Uncomment only the setenv line! # --------------------------------------- # ODROID-VU forced resolution # setenv videoconfig "video=hdmi-a-1:1280x800@60" # ODROID-VU forced EDID # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x800.bin" # 1920x1080 (1080P) with monitor provided EDID information. (1080p-edid) # setenv videoconfig "video=hdmi-a-1:1920x1080@60" # 1920x1080 (1080P) without monitor data using generic information (1080pnoedid) # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" # 1920x1080 50hz (1080P) with monitor provided EDID information. (1080p 50hzedid) # setenv videoconfig "video=hdmi-a-1:1920x1080@50" # 1920x1080 50hz (1080P) without monitor data using generic information (1080p 50hz-noedid) Stand: 26.10.15 - Seite 10 - Ersteller: Stefan W. Lambert
# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080_50hz.bin" # 1440x900 with monitor provided EDID information. # setenv videoconfig "video=hdmi-a-1:1440x900@60" # 1440x900 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1440x900.bin" # 1280x720 (720P) with monitor provided EDID information. (720p-edid) # setenv videoconfig "video=hdmi-a-1:1280x720@60" # 1280x720 (720P) without monitor data using generic information (720pnoedid) # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin" # 1024x768 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x768.bin" # 800x600 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x600.bin" # 720x576 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x576.bin" # 720x480 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x480.bin" # 640x480 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/640x480.bin" # final boot args setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr}" # drm.debug=0xff # Boot the board boot Die farblich markierte Einstellung enthält die Information auf welchem Gerät und welcher Partition sich das rootfs befindet. In diesem Fall ist es die 2.Partition der SD-Karte. Stand: 26.10.15 - Seite 11 - Ersteller: Stefan W. Lambert
Um das rootfs von HDD/SSD einzubinden, muss die UUID des Dateisystems auf /dev/sda1 in die Datei eingetragen werden. fodroidxu-uboot-config # U-Boot Parameters setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" # Mac address configuration (XU3) setenv macaddr "00:1e:06:61:7a:39" #---------------------------------------------------------------------------- -------------------------- # Basic Ubuntu Setup. Don't touch unless you know what you are doing. # -------------------------------- setenv bootrootfs "console=tty1 console=ttysac2,115200n8 root=uuid=079eca2c- 86a1-4ab2-9177-3da396661ad7 rootwait ro fsck.repair=yes" # boot commands 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" # --- Screen Configuration for HDMI --- # # --------------------------------------- # Uncomment only ONE line! Leave all commented for automatic selection. # Uncomment only the setenv line! # --------------------------------------- # ODROID-VU forced resolution # setenv videoconfig "video=hdmi-a-1:1280x800@60" # ODROID-VU forced EDID # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x800.bin" # 1920x1080 (1080P) with monitor provided EDID information. (1080p-edid) # setenv videoconfig "video=hdmi-a-1:1920x1080@60" # 1920x1080 (1080P) without monitor data using generic information (1080pnoedid) # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" # 1920x1080 50hz (1080P) with monitor provided EDID information. (1080p 50hzedid) # setenv videoconfig "video=hdmi-a-1:1920x1080@50" # 1920x1080 50hz (1080P) without monitor data using generic information (1080p 50hz-noedid) # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080_50hz.bin" # 1440x900 with monitor provided EDID information. # setenv videoconfig "video=hdmi-a-1:1440x900@60" Stand: 26.10.15 - Seite 12 - Ersteller: Stefan W. Lambert
# 1440x900 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1440x900.bin" # 1280x720 (720P) with monitor provided EDID information. (720p-edid) # setenv videoconfig "video=hdmi-a-1:1280x720@60" # 1280x720 (720P) without monitor data using generic information (720pnoedid) # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin" # 1024x768 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x768.bin" # 800x600 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x600.bin" # 720x576 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x576.bin" # 720x480 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x480.bin" # 640x480 without monitor data using generic information # setenv videoconfig "drm_kms_helper.edid_firmware=edid/640x480.bin" # final boot args setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr}" # drm.debug=0xff # Boot the board boot Anmerkung für die Bedienung des Texteditors: zum Speichern: gleichzeitiges Drücken der <strg>-taste und 'o' zum Schließen des Editors: gleichzeitiges Drücken der <strg>-taste und 'x' Schritt 13 OdroidNAS rebooten root@odroidnas:/# reboot Stand: 26.10.15 - Seite 13 - Ersteller: Stefan W. Lambert