0

I'm building a new Pi 4b system using the downloaded image of OpenHAB 2.5.3 for a Raspberry Pi on a 64 GB MicroSD card. I'm also going to be using a ridiculously large 500 GB SSD. What I would like to do is to set up separate partitions on the SSD for the main directories, as well as a good size swap file for the 4 GB RAM, and reserve space at the end of the SSD for over-provisioning.

While I have a little Linux experience it's not much. Just enough to be dangerous I guess. LOL.

I was thinking that maybe I start the system using the SD card and let it do it's initial setup and expand the filesystem to fill the SD card. Then use something like "parted" to create various partitions on the SSD, so I could then copy things like /boot, /home, /usr, /opt, /var, etc to their own partitions, as well as creating a swap partition. I seemed to recall from years back that it was a good idea to create separate partitions for various directories. This may not be the case for Debian or an SSD but I don't know if that's true or not.

Once the system is running off the SD card, I would then "somehow" copy those directories or whichever ones someone suggests as being a good layout for a Debian system from the SD card to the SSD.

Since it's a Pi 4b, if I understand this correctly, unlike my Pi 3B's the Pi 4B isn't currently able to boot from the SSD and I would need to have an SD card with the /boot partition to boot from and then switch over to the SSD.

I would also like to keep the very end of the SSD as an unallocated partition for over-provisioning, x GB's or roughly 10% of the SSD.

In addition to OpenHAB, I'm also thinking about doing a webserver on that system as well, somewhere down the road.

I'm at the point where it's like "and then some magic happens" since I don't know how to get the system from the SD card to the SSD and the various directories into partitions on the SSD. I'm very open to suggestions for relative partition sizes on the 500 GB SSD, which directories make sense to have their own partition.

I'm aware of "dd" and I saw something called "rpi-clone" but I don't know if that would be able to copy single directories to an SSD partition. I've also heard of Amanda, for back up and restore, and I'm thinking maybe that's the way to go, once I figure out how to do it. I'm hoping someone can point me in the right direction.

Does anyone have any suggestions on how to do this or is it not worth it?

Thanks, Mark

1

(https://www.tomshardware.com/news/boot-raspberry-pi-from-usb,39782.html) This article here shows you how to boot from an ssd. In a nutshell, you basically make the boot directory point to the ssd and from there it just uses the ssd as a boot drive. Hope this helps.

3
  • 1
    It would be helpful if you could quote a bit more substantially from your source, and explain it in more detail.
    – user96931
    Mar 30 '20 at 16:19
  • Thanks for your reply. I can boot a Pi 3B from USB. I just need to do more research on what to do. From my use of AIX/UNIX systems years ago, the system disk had multiple partitions for certain dirs. So some dirs like /usr, /home, etc had their own partitions.plus one or more for swap. I'm looking for std or "typical" layouts, how big to make the swap part for 4GB RAM. Then what is the most reliable way to copy dirs which are all in /dev/mmcblk1 to their own partitions on SSD. I s/b able to put system to copy on SD card USB reader, boot Pi from another SD Card and then copy things to SSD.
    – SDMark
    Mar 31 '20 at 7:52
  • I gave up on multiple slices for the filesystem. It looks like the swap space is pretty small, around 100MB even for 4 GB of memory, and almost none of it is currently used. As yet. I was thinking separate partitions for parts of the file system might speed it up, but I realized with an SSD that's negligible. I've researched how to list and change partition PARTUUIDs. I had been been using root=/dev/sda2, but using the PARTUUID works better. I'm just going with 3 partitions. 1 for /boot, 1 for /, and a 3rd one at the end for overprovisioning.
    – SDMark
    Apr 21 '20 at 4:05
1

You make it too complicated if you need more space fine but this separate partitions idea is not needed. Once you have it setup on the Pi 4 there is tool in the menus called SD Card Imager I think it is called. Use this with the sd card as the source and the SSD as the destination, choosing the Use Random UUIDs option will ensure the card and SSD have different ones. This is how I cloned mine to the SSD I use the first time, now have script that does it over the network on the running system. If you have the USB boot enabled then it is only a matter of removing the sd card from the machine and letting it boot the new SSD. This if your connector allows it to happen and is compatible with a booting from USB. I provide a couple of links below with the compatible , the chambers link, and with the procedure for the enabling of the USB booting, the Tom's Hardware. They cover quite a bit of ground in doing this. I use the StarTech dongle mentioned it is very good at its job and allows you to enable the TRIM support on the drive too. The boot from SSD is not the holy grail they make it out to be, I switched back to using the chain-load method you describe with the sd card when trouble shooting bad boots, it adds a second or two to the boot process. It came down to my keyboard being attached during boot caused it to fail, to say I am unimpressed with the USB on these things is mild understatement. You do not do a swap partition on SSD it causes too much wear in the area of it use, modern distributions use a swap file in ram drive on SSD disk systems or on the disk itself so it is not dedicated to one section of the drive. The over provisioning is again not needed all SSDs have this already in the drive all you do is take away space that can be used by the OS to keep its wear levelling going good. I stop before I write a book on it, and will provide more to you if needed. Good luck with it.

https://jamesachambers.com/raspberry-pi-4-usb-boot-config-guide-for-ssd-flash-drives/

https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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