SSD on Neuron
I wonder if it is possible use the Neuron with a SSD, including booting and running the OS from the SSD?
@nerdworks. It might be possible but the SSD would have to be connected via USB which is not the best solution... If you are worried abouit the SD card lifetime, we are preparing a solution for this to the Q1/Q2 2018.
As long as /var is writeable I personally prefer using a USB-connected SSD instead of a SD card. Will the solution you are preparing be applicable to existing hardware? I am currently using a L513.
Here is what I did to get the UniPi Neuron running the UniPi Mervis OS image on a SSD connected to USB.
Use the info below on your own risk.
The Neuron should already be running on a SD card using the UniPi Mervis OS image.
No additional software were added to the SD card to complete the steps below.
All steps were done using ssh.
Default ssh login = root:unipi
1: Enable writing to the /boot partition
# mount -o remount,rw /boot
2: Enable Raspberry Pi 3 booting from USB connected mass storage. Please see here for more details.
# echo 'program_usb_boot_mode=1' >> /boot/config.txt
Please be aware that this command is not reversible.
Reboot the Neuron, and log in again.
Verify success by issuing the command:
# vcgencmd otp_dump | grep 17:
The output should read:
After reboot it is a good idea to remove the line added to
This can be done using this command:
# mount -o remount,rw /boot; sed -i '$d' /boot/config.txt
3: Prepare the USB connected disk
Make sure there is only one USB connected mass storage device connected to the Neuron.
Identify the disk by issuing the command:
The output should look something like this:
root@unipi:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111.8G 0 disk |-sda2 8:2 0 1G 0 part |-sda3 8:3 0 1G 0 part `-sda1 8:1 0 60M 0 part mmcblk0 179:0 0 7.4G 0 disk |-mmcblk0p2 179:2 0 1G 0 part / |-mmcblk0p3 179:3 0 1G 0 part /var `-mmcblk0p1 179:1 0 60M 0 part /boot root@unipi:~#
sdais the USB connected disk, and in this case it has three partitions sda1-sda3
mmcblk0is the SD card.
We can also see that none of the partitions on sda is mounted.
Wipe the disk by issuing the command:
# wipefs -a /dev/sda
The disk I used was 120 Gb. Partition sizes should be adjusted accordingly.
Create the following partitions by using:
fdisk -c -u /dev/sda
A 150 Mb Fat32 partition set as bootable. This will become /boot
A 58 Gb Linux partition. This will become /
A 52 Gb Linux partition. This will become /var
A 1.7 Gb swap partition (the rest of the disk).
4: Format the partitions
# mkfs -t vfat -n BOOT -F 32 /dev/sda1 # mkfs -t ext4 /dev/sda2 # mkfs -t ext4 /dev/sda3 # mkswap /dev/sda4
Make sure TRIM is a default mount option
# tune2fs -o discard /dev/sda1 # tune2fs -o discard /dev/sda2 # tune2fs -o discard /dev/sda3 # tune2fs -o discard /dev/sda4
5: Make directories and mount the new partitions
Create a mount point for the partition that will become /
# mkdir /tmp/myssd
Mount the partition that will become /
# mount /dev/sda2 /tmp/myssd
Create mount point for the partition that will become /boot
# mkdir /tmp/myssd/boot
Mount the partition that will become /boot
# mount /dev/sda1 /tmp/myssd/boot
Create mount point for the partition that will become /var
# mkdir /tmp/myssd/var
Mount the partition that will become /var
# mount /dev/sda3 /tmp/myssd/var
6: Copy all content on the SD card to the USB disk
# rsync -ax —progress / /boot /var /tmp/myssd
7: Chroot into the new file system to do required changes
Enter the new file system and mount special file systems prior to chroot
# cd /tmp/myssd/ # mount --bind /dev dev # mount --bind /sys sys # mount --bind /proc proc
Chroot into the new file system
# chroot /tmp/myssd
8: Make new ssh keys
Remove ssh keys copied from the SD card
# rm /etc/ssh/ssh_host_*
Generate new keys
# dpkg-reconfigure openssh-server
Just ignore perl warnings.
/boot/cmdlline.txtto replace SD card with SSD
# sed -i "s,/dev/mmcblk0p1,/dev/sda1,” /etc/fstab # sed -i "s,/dev/mmcblk0p2,/dev/sda2,” /etc/fstab # sed -i "s,/dev/mmcblk0p3,/dev/sda3,” /etc/fstab # echo '/dev/sda4 none swap sw 0 0' >> /etc/fstab # sed -i "s,root=/dev/mmcblk0p2,root=/dev/sda2,” /boot/cmdline.txt
10: Exit chroot, move out of the SSD filesystems and power off the Neuron
# exit # cd ~ # poweroff
11: Remove power from the Neuron and remove the SD card.
12: Boot from SSD
13: Remove local ssh key
Prior to logging in to the Neuron you should remove your locally stored ssh key for the Neuron from your known_hosts file.
/etc/fstabto use UUID instead of partition names
Use UUID instead of partition names in
/etc/fstab. It is wise to do this modification to the fstab in case you attach another USB mass storage device to the Neuron, and what used to be /dev/sda has suddenly become /dev/sdb.
Please see here for details about the use of UUID in
15: Have fun!