0

New Raspberry pi 3B, NOOBS, boots and runs fine out of the box. Now I want to mount an external drive and have everything happen there once boot is complete.

I tried to follow https://learn.adafruit.com/external-drive-as-raspberry-pi-root/overview but even after correcting for the place where it forgot to run a command with sudo, it fails to update the new /etc/fstab or /boot/commandline.txt - and after updating them manually, the pi wouldn't boot and I had to use Shift to get into the editor and put them back the way they were.

To be clear, I'm not trying to boot from the USB drive directly. I understand that's now somewhat possible but it's not what I want to do. I want the SD card to handle original boot, and then mount the external drive as / and have everything else happen there.

The script from Adafruit seemed to a good job of copying files over to the external drive. I think that part is fine. The drive itself works fine - if I leave things alone it shows up in /media/pi. But the goal is to all I/O happen to the external drive after boot - /tmp, /var, /home, everything. So just leaving the drive on /media is not the goal.

Note the drive is being connected to a powered hub; my problem isn't lack of power.

Can someone give exact steps to get this to work? It's a default NOOBs install; the SD came out of the box all set to go. I'm not competent in Linux config so be gentle.

Edit: as requested, fdisk -l output with ram stuff excluded

Disk /dev/mmcblk0: 29.8 GiB, 32010928128 bytes, 62521344 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 512 bytes  
I/O size (minimum/optimal): 512 bytes / 512 bytes  
Disklabel type: dos  
Disk identifier: 0x000dbbe0  

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1         8192  2855468  2847277  1.4G  e W95 FAT16 (LBA)
/dev/mmcblk0p2      2855469 62521343 59665875 28.5G  5 Extended
/dev/mmcblk0p5      2859008  2924541    65534   32M 83 Linux
/dev/mmcblk0p6      2924544  3065855   141312   69M  c W95 FAT32 (LBA)
/dev/mmcblk0p7      3072000 62521343 59449344 28.4G 83 Linux


Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A2FE449B-F1D0-4121-A75D-C3D65CEBFC13

Device     Start       End   Sectors   Size Type
/dev/sda1   2048 976773119 976771072 465.8G Linux filesystem

Note: gparted reports the UUID of /dev/sda1 as 7443c13f-2c7c-4601-bdcb-5371d0587c26 I think the PARTUUID is 56f6bbee-de99-4b17-81a8-9c0dbb84053a

Scott M
  • 103
  • 5

1 Answers1

0

Firstly, you CAN boot a Pi 3 from USB drive - the Foundation site has instructions.

It is actually simple to mount a HDD as root, but as you have given no detail of what you tried this is only an answer in principle. (It is probably more complex using NOOBS, but the principle is the same.)

Firstly you need to mount the HDD, format if necessary, then copy the root partition to the HDD.

NOTE I highly recommend you mount at the command line NOT GUI automount.

Then modify /etc/fstab ON THE MOUNTED copy to point the HDD (probably /dev/sda1, depending on how you set it up). You can also use PARTUID which Raspbian now uses by default, or UUID. The relevant lines will be like the following:-

PARTUUID=ed8acfca-01  /boot           vfat    defaults          0       2
PARTUUID=ed8acfca-02  /               ext4    defaults,noatime  0       1

ONLY modify the root NOT the /boot entry!

Finally modify cmdline.txt in the OS boot partition (which will NOT be the first partition if you are using NOOBS) to point to the new root partition.

dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=ed8acfca-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Milliways
  • 62,573
  • 32
  • 113
  • 225