Best way to boot from HDD?

I know that during initial setup it asks if you will be using an HDD with the Pi. I do. Previously, I have been running Raspbian Wheezy for about 2 years off of an external HDD…

What is the best method to get Dietpi running this way? I.e. SD is needed for initial boot up, but every part of the OS after it booted via USB HDD.

When I had Raspbian, this is the method, I followed:

sudo fdisk -l

Find the disk I need and run:

sudo mount /dev/sd## /mnt

Copy contents from SD to HDD without traversing the filesystem:

sudo rsync -ax / /mnt/

Then changed the rootfs location in:

sudo nano /boot/cmdline.txt

And changed /dev/mmcblk0p1 to be /dev/sdXX:

sudo nano /mnt/etc/fstab

After that added in the swap partition location, etc.

Does the DietPi installation do this when I select that I have an external HDD? Or does it just install programs to the HDD, while keeping rootfs and everything still on the SD card?

If it does not, is it recommended that I do what I did above before running initial setup where it asks me about how I will be using the pi?

If you selected USB drive, DietPi will use your external HDD for software configurations that have personal data paths.

Some examples:

  • owncloud will be setup to use /mnt/usb_1/owncloud_data
  • All software that has a Music path, will use /mnt/usb_1/Music
  • All software that has a downloads path (bittorrent) will use /mnt/usb_1/downloads
    etc etc.

The SD card’s 2nd partition is left as is and does not move to your USB drive.

If you want to move the SD contents over to USB, your best bet would be to:

  • run a fresh install of DietPi
  • Say no to the USB drive prompt.
  • Complete your installation of software

At this point you can use your previous steps to reconfigure your RPi to use the USB drive.