Install Raspbian Fully on External Hard Disk Drive from Image File Downloaded From Raspberrypi.org

Опубликовано: 17 Май 2026
на канале: leefiles
17,875
24

How to install Raspbian fully on an external hard disk drive from an image file downloaded from raspberrypi.org.

"/" will be installed fully on an external hard disk. /boot will remain on an SD card. This is because the raspberry pi will only boot from an SD card.

First make a copy of the downloaded file which is in this format 2013-05-25-wheezy-raspbian.img
We'll call it raspbian.img

Mount partition 2 of the image file:
mount -o loop,offset=$((122880*512)) raspbian.img /mnt/src

To find what the offset is, run:
fdisk -l raspbian.img
Look for the second partition. The start sector is where you get 122880. "Units" will show you how many bytes per sector. For example 512. And that's where you would get the multiplier.

Assuming you've already partitioned your hard drive and formatted it with mkfs.ext4:
Find the external hard disk:
fdisk -l
Mount it:
mount /dev/sda1 /mnt/tmp

Move the files from the image file to the hard drive to install:
mv /mnt/src/* /mnt/tmp
Everything should be moved over except "lost+found" because the empty folder already exists in the destination hard drive. So you can ignore that error if it comes up.

Lastly, edit the boot command line:
Edit with your favorite editor like vi or emacs or nano:
nano /boot/cmdline.txt
Find the name=value pair:
root=/dev/mmcblk0p2
Replace it with: root=/dev/sda1 so that the one line file looks like this:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait

Reboot



I will be running this as a fileserver continuously 24/7 effective immediately. I'll check back many months later and next year unless something fails.

Recorded: July 3, 2013