ASUS Tinker board move SD to USB

After completed installation of DietPi_ASUSTB-ARMv7-Bullseye on my OLD Tinker board I was tempted to try something like build/nand-sata-install at master · armbian/build · GitHub.
There was some trial and error but in the end I did it as below.
USB connected and identified as /dev/sda1, it was already partitioned and formatted with ext4.

  1. Get UUID on the SD and USB
    SD_card=$(ls -l /dev/disk/by-uuid/ | grep mmcblk1p1 | awk '{print $9}')
    USB_disk=$(ls -l /dev/disk/by-uuid/ | grep sda1 | awk '{print $9}')

  2. Save/backup files that will be modified
    cp -p /boot/armbianEnv.txt /boot/armbianEnv.txt.ORG
    cp -p /boot/armbianEnv.txt /boot/armbianEnv.txt.NEW
    cp -p /etc/fstab /etc/fstab.ORG
    cp -p /etc/fstab /etc/fstab.NEW

  3. Update .NEW etc. as root
    sed -i "s/$SDcard/$USB_disk/g" /boot/armbianEnv.txt.NEW
    sed -i "s/$SD_card/$USB_disk/g" /etc/fstab.NEW
    sed -i "s/ext4 noatime,lazytime,rw/ext4 defaults,noatime/g" /etc/fstab.NEW
    mkdir -p /ssd/ssdboot
    echo "UUID=$SD_card /ssd/ssdboot ext4 defaults,noatime 0 1" >> /etc/fstab.NEW
    echo "/ssd/ssdboot/boot /boot none bind 0 0" >> /etc/fstab.NEW

  4. Copy SD to USB
    apt install rsync
    mount /dev/sda1 /media/
    Remove any old files
    rm -rf /media/*
    rsync -ax / /media
    cp -p /boot/armbianEnv.txt.NEW /boot/armbianEnv.txt
    cp -p /media/etc/fstab.NEW /media/etc/fstab
    umount /media

Fingers crossed and reboot
:grinning: :smiley: :smile:

My next step was apt search is really slow, > 10m for apt search git, on a rpi4 · Issue #5162 · MichaIng/DietPi · GitHub
Good Night

So it worked in the end but apt made some problems?
I will move this topic to the community tutorials categorie, because the tutorial character outweighs the problem which appeared after the relocation.

It worked and the issue with slow apt search could be resolved, no SD card to reduce r/w operation on.
Even if apt search was slightly quicker on the SSD drive SAMSUNG MZ7PD128HCFV-000H7 :wink:
My OLD Asus Tinker Board ARMv7 Processor rev 1 (v7l)
Topic move to community tutorials :ok_hand: