29 lines
1.6 KiB
Plaintext
29 lines
1.6 KiB
Plaintext
|
extends article.pug
|
||
|
|
||
|
block article
|
||
|
header
|
||
|
h2 How to move a root from SD card to external drive on Raspberry Pi
|
||
|
div.menu
|
||
|
a(href='/stuff#articles') Go back to articles list
|
||
|
time(datetime='2020-08-15') 15 August 2020
|
||
|
nav
|
||
|
h3 Contents
|
||
|
ol
|
||
|
li #[a(href='#art-1') Introduction]
|
||
|
li #[a(href='#art-2') Moving / to an external drive]
|
||
|
ol
|
||
|
li #[a(href='#art-2-1') If you're doing a fresh install]
|
||
|
li #[a(href='#art-3') cmdline.txt]
|
||
|
|
||
|
h3#art-1 1. Introduction
|
||
|
p Raspberry Pi is known for how it wears off the SD cards. Thankfully you can move the root off the SD card to an external drive and leave there just a boot partition. I'm gonna use a #[s SystemD]GNU/Linux distribution for that.
|
||
|
|
||
|
h3#art-2 2. Moving / to an external drive
|
||
|
p I assume that you have your drive partitioned already. Create the temporary directories for a SD card's boot and root partitions and for a drive. Mount the partitions and issue a command #[code cp -a path/to/sdcard/root/* path/to/drive]. #[code -a] stands for archive. Which recursively copies everything preserving all the attributes and links.
|
||
|
|
||
|
h3#art-2-1 2.1. If you're doing a fresh install
|
||
|
p Then you just install it right on a drive. And then move files from #[code /boot] to a SD card's boot partition. Like that: #[code mv path/to/boot/* path/to/sdcard]. Keep in mind that the boot partition should be formatted in FAT32.
|
||
|
|
||
|
h3#art-3 3. cmdline.txt
|
||
|
p In a #[code cmdline.txt.] file we need to change #[code root=] part. Now it'll look like #[code root=/dev/mmcblk0p2 rw rootwait], and we need to put our drive's root partition instead of that, e.g. #[code root=/dev/sda1 rw rootwait].
|