It is possible to have the root partition on an external USB drive and run RasPBX from there. This has 2 advantages: 1. Faster speed. HDDs (and also SSDs of course) are much faster than SD cards. 2. Higher reliability. The number of writes per sector of an SD card is limited, HDDs instead are much more reliable.
When using an HDD, it has to have it’s own power supply. The RPi’s USB port is not strong enough to power a hard drive on its own.
Thumb drives are not really more reliable than SD cards, there is not much gained using them instead of SD cards reliability wise. But it can still be useful having the root partition on a thumb drive and the procedure is identical to HDDs anyway, so they are covered here, too.
Step 1: Copy the SD card back to an image file
Assuming you have already installed and configured everything on your SD card, and you want to move this over to the USB drive now. You can skip this step and continue with step 2 if you have nothing configured yet or want to start from scratch again.
On Windows, insert the SD card into your reader and start Win32 Disk Imager. Copy the whole SD card to an image file on your hard drive. On MAC and Linux, run this command on the console:
sudo dd bs=1M if=/dev/sdX of=./backup.img
Replace /dev/sdX in the command above with the actual device of your card reader. Run sudo fdisk -l to get a list of all disks on your system.
Step 2: Copy the image file to your USB drive
Now copy the image file to the external USB HDD or thumb drive, in the same way as you’ve done it with your SD card initially. With this step you are deleting all data on your drive, no matter how large it is! If you have skipped step 1, use the original RasPBX image file (raspbx-date.img) instead of the backup image file from step 1. On Windows, use Win32 Disk Imager again, select the image file as source and the USB drive as destination. On MAC/Linux, the command is:
sudo dd bs=1M if=./backup.img of=/dev/sdX
Replace /dev/sdX in the command above with the actual device of your USB drive. Watch out with this step! Don’t use the wrong /dev/sdX as you might accidentally erase one of your computer’s hard drives. Better double and triple check this step to make sure you are really writing to the right device.
The USB drive has to be large enough, it has to have 4GB or more if the original RasPBX image file is used or at least the size of the SD card you’ve been using before.
Step 3: Create an SD card for booting
The RPi still needs an SD card to boot from, but only to load boot loader and kernel, everything else runs off the external drive. You can use the SD card you’ve been using before to run RasPBX and in this case directly continue with step 4. Or create a new card, which doesn’t need to be large or fast, even an old one with only 64MB is sufficient. If the card is already formatted with a FAT32 partition (as all cards are off the shelf) then just delete all files on this card and copy over the files from the first partition of the USB drive created in step 2. On Windows this is easy, as you will only see the FAT partition of this device. Just copy the files on this drive over to the SD card. On MAC/Linux mount the first partition of the USB drive (sized 75MB) and copy the files from there.
Step 4: Configure the RPi to use the external root partition
Now locate the file cmdline.txt on the SD card used for booting (not to confuse with the USB drive). Edit this file in any text editor, and locate the text
in the first line. Replace this with
Now insert the SD card and plug your USB drive into the RPi. It will boot as usual if everything was done properly.