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

3
  • If you post the output of sudo fdisk -l /dev/mmcblk0 and the corresponding entry for your HDD into your Question you can get a more specific answer.
    – Milliways
    Commented Jun 30, 2018 at 23:40
  • raspberrypi.stackexchange.com/questions/757/…
    – Wilf
    Commented Jun 30, 2018 at 23:44
  • The PARTUUID is like Disk identifier: 0x000dbbe0 Your HDD is partitioned GPT, so it does NOT have PARTUUID. I am unsure if you can use GPT to boot a Pi, but if it would I expect you would need to use /dev/sda as identifier. I have only used a MBR HDD. The PI can mount GPT once booted BUT the bootloader is VERY BASIC!
    – Milliways
    Commented Jul 1, 2018 at 2:14

1 Answer 1

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
5
  • I added to the question; note that the PARTUUID for the partition is long and nothing like yours. I'm trying to make lachesis-ext be /, and I get sudo blkid -p /dev/sda1 /dev/sda1: LABEL="rootfs" UUID="7443c13f-2c7c-4601-bdcb-5371d0587c26" VERSION="1.0" TYPE="ext4" USAGE="filesystem" PART_ENTRY_SCHEME="gpt" PART_ENTRY_NAME="lachesis-ext" PART_ENTRY_UUID="56f6bbee-de99-4b17-81a8-9c0dbb84053a" PART_ENTRY_TYPE="0fc63daf-8483-4772-8e79-3d69d8477de4" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="976771072" PART_ENTRY_DISK="8:0"
    – Scott M
    Commented Jul 1, 2018 at 1:49
  • >Firstly, you CAN boot a Pi 3 from USB drive - the Foundation site has instructions. The same page that says there are drives from major manufacturers that don't work as boot devices on a pi? That's exactly why I'm avoiding that approach. I want to be able to replace the drive with anything and be 100% certain it works every time.
    – Scott M
    Commented Jul 1, 2018 at 1:50
  • This worked. The problem with learn.adafruit.com/external-drive-as-raspberry-pi-root/overview is that it doesn't make clear what PARTUUID to use or how to find it. Once I got the PARTUUID for the actual partition in cmdline.txt and /etc/fstab, it worked. One remaining issue: on shutdown, some sort of output happens to the SD - I can see the green activity light flashing. My goal is to make that card as near as possible to never written. What's happening there?
    – Scott M
    Commented Jul 1, 2018 at 4:13
  • @user15001 Raspbian mounts the /boot partition, which is still on SD. There is NO NEED to do this (except for upgrade which update the firmware) if you use noauto instead of defaults it will not automount, and you would need to manually mount to write to it. You could use ro to mount read only (so it could be read). PS the adafruit tutorial is obsolete (apart from its other failings)
    – Milliways
    Commented Jul 1, 2018 at 4:35
  • I will open a separate question for making the SD read-only; I'd like to work out the pros and cons.
    – Scott M
    Commented Jul 2, 2018 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.