Running RasPBX from an External USB HDD or Thumb Drive

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.

15 thoughts on “Running RasPBX from an External USB HDD or Thumb Drive

  1. Hi,
    I bought an new HDD for this now.
    I made some partitions with 100 GB cause this HDD was to big (500GB)
    What should I say. It took a half hour and my PBX is still working.
    Team of raspberry-asterisk did a great job!

  2. Hi
    everything fine , i move files from sd to hdd with yours method and boot ok!

    but now i want to backup whole image from my hdd and transer to another pi with sd …. i need 150gbyte to make image

    i try with gparted to decrease the size of hdd and its ok only 7gbytes but image backup again needs 150gbyte to make image

    so my question, how can i take 7gbyte image from hdd and put to play on sd 16gbyte or sd 8gbyte ?

    thank you

    • I assume you are using dd to copy the image. In this case use the count parameter to limit the number of bytes being copied.

  3. Hello, I have installed the raspbx using external HDD at least three times so far. Everything runs smoothly until powering down the system due to power outage. When powering up again, the system refuses to allow access to web portal, and during boot process it shows several errors related to “read only” files. I have no experience with Linux, but I understand that the system has corrupted file permissions, and it does not load many of the needed components, including apache. This situation happened at least three times during the last three months, and I had to reinstall everything from scratch.

    I can gain access to console via SSH, but no web interface, and phones do not get registered at all.

    Is there a way to get things back to normal without reinstalling the whole system? Sorry about the lack of details, but -again- no experience on linux os.

    Thank you!

  4. Hi guys,

    I after installing i am able to register the phones on PBX and created a SIP trunk for making outgoing call and incoming call using sangoma vega50 gateway. But i am not able to call outside and no incoming calls are landing on extensions as well. Please help.

    Thanks in advance..

    Manoj Sharma

  5. Hey there!

    Thank you for this good tutorial. After backing up and installing everything on a USB stick I was able boot from the USB device.

    The web interface indicates that all IP-phones and trunks are online. But phone calls aren’t possible. Neither by call back nor with my phone. No phone number is reachable.

    Has anyone a clue what the problem could be?

  6. Do you plan to support the Banana Pi? It would be a great addition with dual core 1 ghz cpu and a SATA adaptor. Seems like a killer app of hardware and software.

  7. Hello Gernot,
    I have made that procedure with an 80GB HDD and in fact is much reliable but i would like to understand if raspberry is seeing all the HDD
    or not, because on system statistics have information of HDD 50% space,
    my idea is also to use call recording and I am afraid that i can not use remaining HDD space for that, could you advice please?
    Thank you for your support

  8. Does the USB Drive/Stick have to be “dedicated” for use on the Rpi? I have a 80Gb USB drive that I would like to try for this procedure but would like to retain some windows files that are on the drive. It is already formatted as FAT32.

    • With the instructions above all data on the hard drive will be erased, so watch out if you already have files on it!
      But you can create an additional FAT32 or NTFS partition after applying the procedure above and use this with your Windows computer.

  9. Pingback: Asterisk on a Raspberry Pi – which distribution is best? » TechNotes