A better version of an article on RPi's root moving.
This commit is contained in:
parent
fbae9c5581
commit
c86506d4c2
@ -12,7 +12,7 @@
|
|||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
<loc>https://arav.top/stuff/article/rpi_root_on_external_drive</loc>
|
<loc>https://arav.top/stuff/article/rpi_root_on_external_drive</loc>
|
||||||
<lastmod>2021-09-26</lastmod>
|
<lastmod>2022-05-19</lastmod>
|
||||||
<priority>0.9</priority>
|
<priority>0.9</priority>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
|
@ -8,24 +8,29 @@ block article
|
|||||||
h2 How to move a root from SD card to external drive on Raspberry Pi
|
h2 How to move a root from SD card to external drive on Raspberry Pi
|
||||||
div.menu
|
div.menu
|
||||||
a(href='/stuff#articles') Go back to articles list
|
a(href='/stuff#articles') Go back to articles list
|
||||||
time(datetime='2020-08-15') 15 August 2020
|
time(datetime='2022-05-19') 19 May 2022
|
||||||
nav
|
nav
|
||||||
h3 Contents
|
h3 Contents
|
||||||
ol
|
ol
|
||||||
li #[a(href='#art-1') Introduction]
|
li #[a(href='#art-1') Introduction]
|
||||||
li #[a(href='#art-2') Moving / to an external drive]
|
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]
|
li #[a(href='#art-3') cmdline.txt]
|
||||||
|
|
||||||
h3#art-1 #[a(href='#art-1') 1. Introduction]
|
h3#art-1 #[a(href='#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.
|
p Raspberry Pi is known for how it wears off the SD cards (that's mostly because of logs). 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.
|
||||||
|
p There's nothing different from a regular partitioning of the drives as you usually do when install a Linux distro. Just two things you need to do and be aware of.
|
||||||
|
p First thing is that Raspberry Pi models up to version 3 rev B+ can boot only from a microSD card. Hopefully, that changed with release of 4th version.
|
||||||
|
p Second thing is that you need to edit one file called #[a(href='#art-3') cmdline.txt].
|
||||||
|
|
||||||
h3#art-2 #[a(href='#art-2') 2. Moving / to an external drive]
|
h3#art-2 #[a(href='#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.
|
p So you have your disk(s) partitioned and mounted. A boot partition on a microSD card should be formated to FAT32. You can do this with this command: #[code mkfs.vfat -F32 /dev/sdXY].
|
||||||
|
p Now you can unpack your distro to your disk's root partition and move files from #[code /boot] to a microSD card.
|
||||||
h3#art-2-1 #[a(href='#art-2-1') 2.1. If you're doing a fresh install]
|
p If you have a system previously installed on a microSD card, then move the files to a new root partition using #[code cp -a /path/to/sdcard/root/* /path/to/new/root]. #[code -a] stands for archive, which recursively copies everything preserving all the attributes and links.
|
||||||
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.
|
p Then after repartitioning of a microSD card, move content of a #[code /boot] directory to a new boot partition you made on a microSD card using #[code mv /path/to/new/root/boot/* /path/to/sdcard/new/boot].
|
||||||
|
p Of course, don't forget to add a boot mount to a #[code fstab] file: #[code UUID=xxx /boot vfat defaults 0 0].
|
||||||
|
|
||||||
h3#art-3 3. #[a(href='#art-3') cmdline.txt]
|
h3#art-3 3. #[a(href='#art-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].
|
p So, the main part is done, now it is time to tell Raspberry where is a root partition.
|
||||||
|
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].
|
||||||
|
p Instead of #[code /dev/sdXY] you may try to use a #[code PARTUUID=], but it didn't work for me, fully it would look like #[code root=PARTUUID=XXXX].
|
||||||
|
p And, #[code UUID] and #[code PARTUUID] can be gotten with #[code blkid] utility.
|
||||||
|
@ -31,7 +31,7 @@ block content
|
|||||||
a(href='stuff/article/setting_up_a_tor_proxy_relay_hiddenserv') Setting up a Tor proxy, relay and hidden service
|
a(href='stuff/article/setting_up_a_tor_proxy_relay_hiddenserv') Setting up a Tor proxy, relay and hidden service
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
time(datetime='2020-08-15') 15 August 2020
|
time(datetime='2022-05-19') 19 May 2022
|
||||||
td
|
td
|
||||||
a(href='stuff/article/rpi_root_on_external_drive') How to move a root partition from SD card off to external drive on Raspberry Pi
|
a(href='stuff/article/rpi_root_on_external_drive') How to move a root partition from SD card off to external drive on Raspberry Pi
|
||||||
section#programs-scripts
|
section#programs-scripts
|
||||||
|
Loading…
Reference in New Issue
Block a user