At the moment MSD is only available in the branch=next firmware.
Which gave me issues as BT was going down all the time.
For me this solution works great and still able to run /root from my external HDD.
It's not my solution, as it is existing already i only gave it my twist.
Downside you still need an SD card to boot.
The advantage is that all data is written to your external HDD.
And it saves me a third upcoming corrupt sd card

Right now I use a "Seagate Expansion Portable 1TB" without USB hub.
Looks like the Pi3 with stock 5v 2.5A provides enough power to feed this disk.
I had to enable max_usb_current=1 so instead of 0.6 - 1.2A is sent through the USB port.
Which is only available on the Pi2+ and Pi3 as far as i know.
Below you'll find a description as how I configured it.
Assume that you have some expertise on Raspberry as i can't describe all the details

-------------------------------------------------- ------------
Step 1: Backing up or new SD Card stabbing
Make a backup of your existing setup.
Or in my case i used another 2gb sd card.
Step 2: Jessie download and transfer
Download Jessie Lite image in case of a headless set-up and drop it if you use Windows on your SD card using win32diskmanager.
Insert the SD card into your Pi and Pi on the boat.
Step 3: Pi Configuring
Please log in via ssh and configure the Pi first
sudo Raspi-config
- Expand filesystem and reboot
Login again and configure the rest
- Set locales
- Set Time Zone
- Set new password
- Ect ect
reboot again
Step 4: Static IP for Pi
If you want to have a static IP you want to Pi follow this step.
Otherwise, you can skip this step.
Log back in via ssh:
sudo nano /etc/dhcpcd.conf
The following static IP settings are focused on my situation.
Find out what your gateway ect and adjust if necessary.
Code: Select all
interface eth0
static ip_address=192.168.178.110/24
static routers=192.168.178.1
static domain_name_servers=8.8.8.8
Finish with ctrl o followed by enter.
And to exit ctrl x
Reboot the Pi to let these setting take effect.
Step 5: Max USB current
Now we go to if you are going to provide your USB ports more Amps incase of a unpowered external HDD.
Note that max_usb_current=1 is only available for Pi2 + and Pi3 as far as I know
Log back in via SSH.
sudo nano /boot/config.txt
Copy /Past the following line at the bottom in the config.txt
Code: Select all
max_usb_current=1
To exit ctrl x
Reboot the Pi to let this setting take effect.
Step 6: OS update and install required packages
Now we will update your OS and already install some needed packages.
Log back in via SSH.
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install rsync
Optionally, if you want to use the beta kernel:
sudo apt-get install RPI update -y
sudo RPI update
installed everything? Reboot your Pi again
Step 7: Prepping your External Disk
We are going to prepare the external drive so that it can carry the /root.
In SSH enter 'sudo blkid "and take notice of what you see there.
It will be easier later on to find your just inserted external HDD.
Now insert the external HDD and enter again "sudo blkid"
And see which disk just has been added.
In my example, I take "sda" in my examples below.
We will now give the HDD a full ext4 partition.
in SSH: sudo parted /dev/sda
With the above command you start parted and all processing is now done on your external HDD
In parted do the following:
mktable msdos
Here you get a message that all data will be removed from your HDD.
Agree if you want to proceed.
--------------
Then:
mkpart primary ext4 0% 100%
It creates an ext4 partition along the entire length of your external HDD
--------------
Now you can review using the command "print"
Will be something like:
Code: Select all
Number Start End Size Type File system Flags
1 1049kB 1000GB 1000GB primary ext4
To exit parted you enter the command "quit"
Only thing remaining is to tune the ext4 partition.
You do this by running the following command in SSH
sudo mkfs.ext4 /dev/sda1
Step 8: /root transfer to the external drive
Now we are ready to copy /root from sd-card to your external HDD partition.
In SHH, run it out below.
sudo mkdir /mnt/usbdrive
sudo mount /dev/sda1 /mnt/usbdrive/
sudo rsync -ax --progress / /mnt/usbdrive
May take some time before all the files are transferred
Step 9: Renew Certificates
Now we are going to renew the certificates on the HDD.
Otherwise you will no longer be able to log in via SSH.
In SSH, run the following commands:
cd /mnt/usbdrive
sudo mount --bind /dev dev
sudo mount --bind /sys sys
sudo mount --bind /proc proc
sudo chroot /mnt/usbdrive
rm /etc/ssh/ssh_host*
dpkg-reconfigure openssh-server
exit
sudo umount dev
sudo umount sys
sudo umount proc
Step 10: cmdline and fstab adjust
We are almost there.
We are going to adjust the boot cmdline and fstab to let your Pi know to seek on your external HDD.
Perform "sudo blkid" and locate your external HDD.
There will be something along the lines of:
Code: Select all
/dev/sda1: UUID="eda23afa-a07c-4ca5-8b00-f14b6f09095e" TYPE="ext4" PARTUUID="5905022c-01"
The UUID hash is the name of your disk and PARTUUID hash your partition.
Normally, you could refer to the /root for example to /dev/sda
But we do not want to because if you ever going to use a USB stick later on it may screw everything up.
Resulting in a non booting Pi as it can't find /dev/sda because your OS has given it to your stick.
Instead, we use UUID and PARTUUID so no matter what you put into the Pi it will find your HDD using the hash
SSH in the following commands:
sudo sed -i "s,root=/dev/mmcblk0p2,root=PARTUUID=5905022c-01," /boot/cmdline.txt
sudo sed -i "s,/dev/mmcblk0p2,UUID=eda23afa-a07c-4ca5-8b00-f14b6f09095e," /etc/fstab
Now you can optionally verify cmdline.txt and fstab if the above has been applied.
Should look like the following:
- /boot/cmdline.txt
Code: Select all
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=5905022c-01 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Code: Select all
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
UUID=eda23afa-a07c-4ca5-8b00-f14b6f09095e / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
Now we are ready and the external HDD contains everything from your sd-card /root.
If you've done everything properly your Pi will now start from the SD card and run from your external HDD.
SSH for now following commands.
cd ~
sudo umount /mnt/usbdrive
sudo rmdir /mnt/usbdrive
sudo reboot
If everything goes well then your Pi now reboots from the SD card and is running from your external HDD.
Step 12: Optional remove /root partition from your SD card [/ b]
You can now optionally remove /root partition from your SD card as we no longer need this.
SSH
sudo parted /dev/mmcblk0
rm 2 (2 stands for partition 2 verify it first using "print")
quit
sudo reboot
Step 13: Optional Domoticz install [/ b]
If want to have a fresh Domoticz installation.
Then you can SSH using "sudo curl -L install.domoticz.com | bash"
But you did above tut with your production Domoticz sd card then it should have been started already.
Last words [/ b]
It only remains me to say that hopefully someone overhere has a benefith by using this tut.
I'm still a noob in raspberry field and not so good it writing explanations.

Google was my best friend and using various found tuts on how to mount USB sticks, MSD mode to combine Pi3 to above tut.
Goodluck