Pine A64: - Move the filesystem to a USB Drive

Hi k-plan,

I tried performing same routing for Pine64 board. Unfortunately I have not gotten same result. I still see original partition and new data still being written to original partition. Please let me know what you think


Thanks
Jorge

Hi dyteso,

Please let me know what you think

What I think?

  • you boot up form 1. partition (FAT) from sd-card
  • your root file system is on 2. partition on sd-card
  • your USB stick is mounted under /mnt/usb_1
  • something is going wrong

But seriously, I don’t know what is going wrong. Don*t know, who Pine A64 manage it boot process.
Pine A64 is not my construction area, I don’t have such a device and did not have a look at rhkean image. Sorry.
Please ask him.

here is boot.ini from pine64

ODROIDXU-UBOOT-CONFIG

# U-Boot Parameters
setenv initrd_high "0xffffffff"
setenv fdt_high "0xffffffff"

# Mac address configuration
setenv macaddr "??????????????????????????"

#------------------------------------------------------------------------------------------------------
# Basic Ubuntu Setup. Don't touch unless you know what you are doing.
# --------------------------------
setenv bootrootfs "console=tty1 root=UUID=d5188f7b-4ef5-4596-af76-30491e6b247e rootwait rootdelay=10 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.d$

same problem here :frowning: did not work …

Pine64 Boot from HDD / USB etc working with original debian image:

pine64-image-debianbase-310102bsp-2

just add here: /boot/uEnv.txt

root=/dev/sda1

or

root=UUID=d5188f7b-4ef5-4596-af76-30491e6b247e rootwait

and change /mnt/usb_1/etc/fstab… if you mounted it to usb_1

That’s it!

Hi maxtox (or anyone else who has gotten this work). I have followed this tutorial with the edits you’ve made for getting the Pine64 to boot off the SD card and have the file system on an external HDD. However I still can not get this to work. Is there anyway you could help me out in getting this working please! This is been a pain in my A for a long time and I can’t seem to get it to work. I’ve been able to get it to work on RPis in the past and I’d really like to get this working on my Pine so I can prolong the life on the SD card.

Thanks

I have used the technique below to do what you want on Banana Pi M1 and orange Pi Zero - in both of these cases DietPi is based on Armbian.

If this is the case with Pine64 (Fourdee?) then look here:

https://forum.armbian.com/index.php?/topic/329-moving-linux-to-sata-or-external-drive/

Hi,

Sorry, no Armbian based image in DietPi for Pine A64

───────────────────────────────────────
DietPi | 19:19 | Tue 10/04/17
───────────────────────────────────────
V148 | Pine A64+ 1GB (aarch64)
───────────────────────────────────────
IP Address | 192.168.1.100
───────────────────────────────────────

Device image possible thanks to: Longsleep, Rhkean



DietPi for Pine A64 > is currently based on longsleeps’s excellent simpleImage (U-boot + BSP kernel) with Debian Jessie (arm64) debootstrap (according to these instructions: > https://wiki.debian.org/Arm64Port#Debootstrap_arm64 > ). The DietPi also make use of longsleep’s u-boot and kernel update scripts to keep in sync with his ongoing development work.


root@Pine64:~# cat /boot/Image.version
3.10.104-2-pine64-longsleep

root@Pine64:~# cat /etc/debian_version
8.7

root@Pine64:~# uname -a
Linux Pine64 3.10.104-2-pine64-longsleep #113 SMP PREEMPT Thu Dec 15 21:46:07 CET 2016 aarch64 GNU/Linux

root@Pine64:~# cat /etc/.dietpi_image_version
144

root@Pine64:~# cat /DietPi/dietpi/.version
148

cu
k-plan

Hi,

Technically it is the same as my tutorial for Odroid device you can found here.

But, as @maxtox wrote, you have to edit uEnv.txt.

cu
k-plan

Hi,

System:
DietPi v148 | Pine A64+ 1GB Board (e.g. in my case a fresh installation)
Micro SD-Card: - SanDisk microSDHC Ultra 4GB
USB Device: - SanDisk Cruzer Fit 8GB USB-Stick 2.0
Hint: - Don’t use this crappy SD-Card or USB Flash drive - I do this only for my tests ! !

Note:

  • should work on Pine devices like: Pine A64+ 1GB Board (tested) and Pine A64+ 2GB Board or Pine A64 512MB Board (not teted!)
    Why to use this “extended version”?
    Because it’s possible to use more than only one usb drive attached to your device.



    # Preparation
  • Install some tools we’ll need later:
root@oDroid-C1-TEST:~# apt-get install rsync
  • Locate the root file system ( “/” =>> /dev/mmcblk0p2" ):
root@Pine64:~# df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/mmcblk0p2  3,6G    799M  2,6G   24% /
devtmpfs        458M       0  458M    0% /dev
tmpfs           491M       0  491M    0% /dev/shm
tmpfs           491M    6,7M  484M    2% /run
tmpfs           5,0M       0  5,0M    0% /run/lock
tmpfs           491M       0  491M    0% /sys/fs/cgroup
tmpfs            10M    1,2M  8,9M   12% /DietPi
tmpfs            20M     28K   20M    1% /var/log
tmpfs           491M    4,0K  491M    1% /tmp
/dev/mmcblk0p1   50M     14M   37M   28% /boot

In this example, “/” is on “/dev/mmcblk0p2” , the second partition on sd-card.

\

  • Insert USB drive and check to see if usb decice is recognized:
root@Pine64:~# lsusb
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • Formatting the USB drive:
root@Pine64:~# dietpi-drive_manager
root@Pine64:~# dietpi-services stop
  • Create a new directory:
root@Pine64:~# mkdir /mnt/usb_1
  • Mounting USB device:
root@Pine64:~# mount /dev/sda1 /mnt/usb_1/
  • Copy the filesystem over to your new partition:
root@Pine64:~#  rsync -axv / /mnt/usb_1/
...
sent 485,999,479 bytes  received 431,075 bytes  7,314,745.17 bytes/sec
total size is 484,388,706  speedup is 1.0

Be patient - this will take some time!

\

  • Get your partition UUID for fstab:
root@Pine64:~# lsblk -f
NAME        FSTYPE LABEL  UUID                                 MOUNTPOINT
sda
+-sda1      ext4          4e290413-2836-49c1-be7a-a023679b0153 /mnt/usb_1
  • Backup and edit the fstab file on your new filesystem:
root@Pine64:~#  cp /mnt/usb_1/etc/fstab /mnt/usb_1/etc/fstab.sdcard
root@Pine64:~#  nano /mnt/usb_1/etc/fstab
  • Comment out the old filesystem at /dev/mmcblk0p2 and add the new line pointing to your new filesystem and add your UUID as indicated.
#Internal Drives---------------------------------------------------
proc            /proc           proc    defaults                                                         0 0
/dev/mmcblk0p1  /boot           auto    defaults,noatime,discard                  0 2

## rootfs on SD-Card
## /dev/mmcblk0p2  /               auto    defaults,noatime,discard                0 1

## rootfs on USB device
/dev/disk/by-uuid/4e290413-2836-49c1-be7a-a023679b0153    /        ext4    defaults,noatime,nodiratime         0 1

tmpfs                   /tmp                    tmpfs   defaults,noatime,nodev,nosuid,mode=1777                         0 0
tmpfs                   /var/log                tmpfs   defaults,size=20m,noatime,nodev,nosuid,mode=1777       0 0
tmpfs                   /DietPi                 tmpfs   defaults,size=10m,noatime,nodev,nosuid,mode=1777        0 0

#External Drives---------------------------------------------------
#NB: Please use dietpi-drive_manager to setup and control your external drives.

#Samba Client------------------------------------------------------
#/mnt/samba . Please use dietpi-config and the Networking Options: NAS menu to setup this mount

#FTP Client Mount--------------------------------------------------
#/mnt/ftp_client . Please use dietpi-config and the Networking Options: NAS menu to setup this mount

#NFS Client Mount--------------------------------------------------
#/mnt/nfs_client . Please use dietpi-config and the Networking Options: NAS menu to setup this mount
#UUID=4e290413-2836-49c1-be7a-a023679b0153       /mnt/4e290413-2836-49c1-be7a-a023679b0153      auto     defaults,noatime,nofail,x-systemd.automount  0 0
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

… and save the file!

\

  • Unmount your USB device and delete directory:
root@Pine64:~# umount /dev/sda1

root@Pine64:~# rmdir /mnt/usb_1/
  • Backup your uEnv.txt file and edit it to include your new partition UUID:
root@Pine64:~# cp /DietPi/uEnv.txt /boot/uEnv.txt.sdcard



root@Pine64:~# nano /DietPi/uEnv.txt



console=tty0 no_console_suspend console=tty1
kernel_filename=pine64/Image
initrd_filename=initrd.img

## Boot from USB device
root=UUID=4e290413-2836-49c1-be7a-a023679b0153 rootdelay=10

ethaddr=36:c9:e3:f1:b8:05

optargs=disp.screen0_output_mode=1080p50

… watch for “ root=UUID= … ” and " rootdelay=10 " and save the file!

\

  • Cross the fingers and reboot your Pine A64:
root@Pine64:~# reboot

If your USB device have a activity LED, you can check here R/W activity.
First boot up time take some time, so be patient!

\

  • After your device has booted up, check the filesystem information:
root@Pine64:~# df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/sda1       7,3G    899M  6,0G   13% /
devtmpfs        458M       0  458M    0% /dev
tmpfs           491M       0  491M    0% /dev/shm
tmpfs           491M    6,7M  484M    2% /run
tmpfs           5,0M       0  5,0M    0% /run/lock
tmpfs           491M       0  491M    0% /sys/fs/cgroup
tmpfs            10M    1,2M  8,9M   12% /DietPi
tmpfs            20M     16K   20M    1% /var/log
tmpfs           491M    4,0K  491M    1% /tmp
/dev/mmcblk0p1   50M     14M   37M   28% /boot
  • Create a new swap file (e.g. 100 MB):
root@Pine64:~# dietpi-config

2017-04-10 16-35-41.png

  • Now benchmark filesystem and RAM IO performance:

    … and reboot.


    Note:
  • To boot your device, you must have insert SD-Card any time. Without it will not boot.
  • If somethings goes wrong or your device doesn’t boot, power off your device, put SD-Card into your PC and restore " uEnv.txt.sdcard " to " uEnv.txt " on the DOS (FAT) partition named "boot "
  • Put edited SD-Card back into your device and power on. It will boot and run the system (DietPi) now from SD-Card like before your modifications.

Puh, this will be the last write-up for a long time. Sorry, to much work and very time-consuming.

Will spilt this thread in a new one with a correct title.

Thanks for the info guys. I’ll give it a try. I’ve had to step away from this project right now, but I’ll be sure to give this a look when I have more free time.

Thanks again

Hi k-plan,

I got your tutorial to work thank you so much. I think the problem I had before was I missed setting the USB to MBR!

Thanks again!. It was super easy to follow…as long as you follow ALL of the instructions :roll_eyes:

  • Drew