Saturday, 6 July 2013

Move OS to a USB HDD

General notes that worked for me

Unmount the device.
  sudo umount /dev/sda1

Delete existing partitions and create a new primary partition.
  sudo fdisk /dev/sda1

Format and check the device.
  sudo mkfs.ext4 /dev/sda1
  sudo e2fsck /dev/sda1

Mount and copy the OS from the SD card.
  sudo mount /dev/sda1 /media/hdd
  sudo dd if=/dev/root of=/dev/sda1 bs=4M

Delete and add the partion (with same settings as previous partitioning).
  sudo fdisk /dev/sda1

Resize the device
  sudo resize2fs /dev/sda1

Edit FSTAB on the device.
  sudo nano /media/hdd/etc/fstab

  proc            /proc           proc    defaults          0       0
  /dev/mmcblk0p1  /boot           vfat    defaults          0       2
  /dev/sda1       /               ext4    defaults,noatime  0       1

Change boot parameters on the SD card so that the USB HDD is used as main device for OS.
  sudo nano /boot/cmdline.txt

  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait

Reboot :)
  sudo reboot


Reference: http://c-mobberley.com/wordpress/index.php/2013/04/13/moving-raspberry-pi-root-folders-from-sd-card-to-usb-hdd/

No comments:

Post a Comment