Move under www to ease rsync
This commit is contained in:
BIN
www/eps/hpr2023/hpr2023_RPi_server_collection.png
Executable file
BIN
www/eps/hpr2023/hpr2023_RPi_server_collection.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 396 KiB |
149
www/eps/hpr2023/hpr2023_adafruit-pi-externalroot-helper.txt
Executable file
149
www/eps/hpr2023/hpr2023_adafruit-pi-externalroot-helper.txt
Executable file
@@ -0,0 +1,149 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# adafruit-pi-externalroot-helper
|
||||
#
|
||||
# Configure a Raspbian system to use an external USB drive as root filesystem.
|
||||
#
|
||||
# See README.md for details and sources.
|
||||
|
||||
set -e
|
||||
|
||||
function print_version() {
|
||||
echo "Adafruit Pi External Root Helper v0.1.0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function print_help() {
|
||||
echo "Usage: $0 -d [target device]"
|
||||
echo " -h Print this help"
|
||||
echo " -v Print version information"
|
||||
echo " -d [device] Specify path of device to convert to root"
|
||||
echo
|
||||
echo "You must specify a device. See:"
|
||||
echo "https://learn.adafruit.com/external-drive-as-raspberry-pi-root"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Display an error message and quit:
|
||||
function bail() {
|
||||
FG="1;31m"
|
||||
BG="40m"
|
||||
echo -en "[\033[${FG}\033[${BG}error\033[0m] "
|
||||
echo "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Display an info message:
|
||||
function info() {
|
||||
task="$1"
|
||||
shift
|
||||
FG="1;32m"
|
||||
BG="40m"
|
||||
echo -e "[\033[${FG}\033[${BG}${task}\033[0m] $*"
|
||||
}
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
bail "must be run as root. try: sudo adafruit-pi-externalroot-helper"
|
||||
fi
|
||||
|
||||
# Handle arguments:
|
||||
args=$(getopt -uo 'hvd:' -- $*)
|
||||
[ $? != 0 ] && print_help
|
||||
set -- $args
|
||||
|
||||
for i
|
||||
do
|
||||
case "$i"
|
||||
in
|
||||
-h)
|
||||
print_help
|
||||
;;
|
||||
-v)
|
||||
print_version
|
||||
;;
|
||||
-d)
|
||||
target_drive="$2"
|
||||
echo "Target drive = ${2}"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ! -e "$target_drive" ]]; then
|
||||
bail "Target ${target_drive} must be existing device (use -d /dev/foo to specify)"
|
||||
fi
|
||||
|
||||
info "start" "Will create new ext4 filesystem on ${target_drive}"
|
||||
info "start" "If there is data on ${target_drive}, it will be lost."
|
||||
read -p "Really proceed? (y)es / (n)o " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
echo "Quitting."
|
||||
exit
|
||||
fi
|
||||
|
||||
export target_partition="${target_drive}1"
|
||||
|
||||
info "dependencies" "Installing gdisk, rsync, and parted."
|
||||
# All except gdisk are probably installed, but let's make sure.
|
||||
apt-get install gdisk rsync parted
|
||||
|
||||
info "fs create" "Creating ${target_partition}"
|
||||
# The alternative here seems to be to pipe a series of commands
|
||||
# to fdisk(1), similar to how it's done by raspi-config:
|
||||
# https://github.com/asb/raspi-config/blob/3a5d75340a1f9fe5d7eebfb28fee0e24033f4fd3/raspi-config#L68
|
||||
# This seemed to work, but I was running into weirdness because
|
||||
# that doesn't seem to make a GPT, and later on I couldn't get
|
||||
# partition unique GUID from gdisk. parted(1) is also a nice
|
||||
# option because it's scriptable and allows partition sizes to
|
||||
# be specified in percentages.
|
||||
parted --script "${target_drive}" mklabel gpt
|
||||
parted --script --align optimal "${target_drive}" mkpart primary ext4 0% 100%
|
||||
|
||||
info "fs create" "Creating ext4 filesystem on ${target_partition}"
|
||||
mkfs -t ext4 -L rootfs "${target_partition}"
|
||||
|
||||
info "fs id" "Getting UUID for target partition"
|
||||
eval `blkid -o export "${target_partition}"`
|
||||
export target_partition_uuid=$UUID
|
||||
|
||||
info "fs id" "Getting Partition unique GUID for target filesystem"
|
||||
# Ok, so the only way I was able to get this was using gdisk.
|
||||
# I don't quite understand the different between this value and
|
||||
# the one you can get with blkid and tune2fs (which seem to give
|
||||
# the same thing). Nevertheless, this seems to be necessary to
|
||||
# get a value that can be used in cmdline.txt. I think it's a
|
||||
# GUID specifically for the GPT partition table entry.
|
||||
export partition_unique_guid=`echo 'i' | sudo gdisk "${target_drive}" | grep 'Partition unique GUID:' | awk '{print $4}'`
|
||||
|
||||
info "fs id" "Target partition UUID: ${target_partition_uuid}"
|
||||
info "fs id" "Partition unique GUID: ${partition_unique_guid}"
|
||||
|
||||
info "fs copy" "Mounting ${target_partition} on /mnt"
|
||||
mount "${target_partition}" /mnt
|
||||
|
||||
info "fs copy" "Copying root filesystem to ${target_partition} with rsync"
|
||||
info "fs copy" "This will take quite a while. Please be patient!"
|
||||
rsync -ax / /mnt
|
||||
|
||||
info "boot config" "Configuring boot from {$target_partition}"
|
||||
# rootdelay=5 is likely not necessary here, but seems to do no harm.
|
||||
cp /boot/cmdline.txt /boot/cmdline.txt.bak
|
||||
sed -i "s|root=\/dev\/mmcblk0p2|root=PARTUUID=${partition_unique_guid} rootdelay=5|" /boot/cmdline.txt
|
||||
|
||||
info "boot config" "Commenting out old root partition in /etc/fstab, adding new one"
|
||||
# These changes are made on the new drive after copying so that they
|
||||
# don't have to be undone in order to switch back to booting from the
|
||||
# SD card.
|
||||
sed -i '/mmcblk0p2/s/^/#/' /mnt/etc/fstab
|
||||
echo "/dev/disk/by-uuid/${target_partition_uuid} / ext4 defaults,noatime 0 1" >> /mnt/etc/fstab
|
||||
|
||||
info "boot config" "Ok, your system should be ready. You may wish to check:"
|
||||
info "boot config" " /mnt/etc/fstab"
|
||||
info "boot config" " /boot/cmdline.txt"
|
||||
info "boot config" "Your new root drive is currently accessible under /mnt."
|
||||
info "boot config" "In order to restart with this drive at /, please type:"
|
||||
info "boot config" "sudo reboot"
|
||||
179
www/eps/hpr2023/hpr2023_full_shownotes.html
Executable file
179
www/eps/hpr2023/hpr2023_full_shownotes.html
Executable file
@@ -0,0 +1,179 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="author" content="Dave Morriss">
|
||||
<title>Setting up my Raspberry Pi 3 (HPR Show 2023)</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="http://hackerpublicradio.org/css/hpr.css">
|
||||
</head>
|
||||
|
||||
<body id="home">
|
||||
<div id="container" class="shadow">
|
||||
<header>
|
||||
<h1 class="title">Setting up my Raspberry Pi 3 (HPR Show 2023)</h1>
|
||||
<h2 class="author">Dave Morriss</h2>
|
||||
<hr/>
|
||||
</header>
|
||||
|
||||
<main id="maincontent">
|
||||
<article>
|
||||
<header>
|
||||
<h1>Table of Contents</h1>
|
||||
<nav id="TOC">
|
||||
<ul>
|
||||
<li><a href="#introduction">Introduction</a></li>
|
||||
<li><a href="#hardware">Hardware</a></li>
|
||||
<li><a href="#setup">Setup</a><ul>
|
||||
<li><a href="#running-off-the-ssd">Running off the SSD</a></li>
|
||||
<li><a href="#what-the-script-does">What the script does</a></li>
|
||||
<li><a href="#reverting-to-the-sd-card">Reverting to the SD card</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#picture">Picture</a></li>
|
||||
<li><a href="#epilogue">Epilogue</a></li>
|
||||
<li><a href="#links">Links</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<p>I bought a Raspberry Pi 3 in March 2016, soon after it was released. I want to use it as a server since it's the fastest Pi that I own, so I have tried to set it up in the best way for that role.</p>
|
||||
<p>In this episode I describe what I did in case you want to do something similar.</p>
|
||||
<h2 id="hardware">Hardware</h2>
|
||||
<p>The equipment I bought:</p>
|
||||
<ul>
|
||||
<li>The Raspberry Pi model 3</li>
|
||||
<li>A Pimoroni Pibow 3 <em>Ninja</em> case
|
||||
<ul>
|
||||
<li>This is an acrylic case made from laser-cut layers, suitable for the RPi3 and with room to contain a <a href="https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/" title="Raspberry Pi HAT">HAT</a> if required. Apparently it has better ventillation than RPi2 cases</li>
|
||||
</ul></li>
|
||||
<li>A 2.5 amp Universal Power Supply
|
||||
<ul>
|
||||
<li>The ones I already had are 2 amp or less</li>
|
||||
</ul></li>
|
||||
<li>A 6mm heat sink (with enough clearance in case I want to fit a HAT on the Pi)
|
||||
<ul>
|
||||
<li>The Pi3 generates more heat I'm told</li>
|
||||
</ul></li>
|
||||
<li>A USB to SATA converter
|
||||
<ul>
|
||||
<li>Has 2 USB connectors with one for boosting the power; not needed on the Pi3</li>
|
||||
</ul></li>
|
||||
<li>A 120GB internal SSD</li>
|
||||
<li>A 32GB microSD Class 10 card
|
||||
<ul>
|
||||
<li>Probably overkill!</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<p>The 2.5 amp PSU is necessary because I'm powering the SSD from the Pi and lower rated supplies will be inadequate since the Pi3 draws more current itself.</p>
|
||||
<p>There are links at the end, but these merely document my choices and shouldn't be taken as recommendations or an attempt to sell anything.</p>
|
||||
<h2 id="setup">Setup</h2>
|
||||
<p>I installed the latest <a href="https://www.raspberrypi.org/downloads/raspbian/" title="Raspbian">Raspbian</a> (Jessie) on the microSD card. I plugged in my old VGA monitor which I use occasionally for this type of thing. I have an HDMI/VGA adaptor cable for doing this. I connected a USB keyboard and mouse and made sure the Pi was good to go.</p>
|
||||
<p>The main things I do when configuring a Pi are:</p>
|
||||
<ul>
|
||||
<li>Configure my router to give it a fixed IP address, and add it to my various <code>/etc/hosts</code> files on other systems. This is for the LAN connection. I run all my Pi's directly from my router or from one of four Gigabit switches around the house.</li>
|
||||
<li>Install <code>vim</code> on the Pi</li>
|
||||
<li>Ensure an <code>ssh</code> server is running - it wasn't always there in older versions.</li>
|
||||
<li>Create an account, and add it to the <code>sudoers</code> file (with <code>visudo</code>). I use the same account on all my Pi's so I can administer them with <code>cssh</code></li>
|
||||
<li>Share my ssh key so I can login without a password</li>
|
||||
<li>Change the password on the <code>pi</code> account</li>
|
||||
<li>Use <code>raspi-config</code> to make the Pi boot to text mode</li>
|
||||
<li>Set the Pi up in its final location in headless mode</li>
|
||||
</ul>
|
||||
<p>In this case I added some further steps to the setup to use the SSD as the root disk.</p>
|
||||
<h3 id="running-off-the-ssd">Running off the SSD</h3>
|
||||
<p>I had set this up within the last year for another one of my Raspberry Pi's, a Pi2. In this one I'd added an external 1TB disk powered through a powered USB hub. In doing this I used the <a href="https://learn.adafruit.com/external-drive-as-raspberry-pi-root/overview" title="Using an External Drive as a Raspberry Pi Root Filesystem">Adafruit tutorial</a> which describes this process. This tutorial is based on the article <a href="https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177" title="HOWTO: Move the filesystem to a USB stick/Drive">"HOWTO: Move the filesystem to a USB stick/Drive"</a>, by <em>paulv</em> on the Raspberry Pi forums.</p>
|
||||
<p>As an aside, I'd bought a <a href="https://thepihut.com/products/flirc-raspberry-pi-3-b-case" title="FLIRC Raspberry Pi 2/3 Case">FLIRC aluminium case</a> for this Pi2 because it incorporated a heatsink and was quite attractive and seemed very robust. I believe that this case can't be used with the Pi3 because it will block the WiFi and Bluetooth, but I can't find any confirmation that this is so. I haven't tried swapping Pi's between cases.</p>
|
||||
<p>To run the Adafruit solution I did the following:</p>
|
||||
<ul>
|
||||
<li>Connected everything up using the Raspbian SD card</li>
|
||||
<li>Determined what device my SSD was connected to - <code>/dev/sda1</code>
|
||||
<ul>
|
||||
<li>Used <code>dmesg</code> to find the log messages</li>
|
||||
</ul></li>
|
||||
<li>Grabbed the Adafruit code at <a href="https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper" class="uri">https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper</a>
|
||||
<ul>
|
||||
<li><code>git clone git@github.com:adafruit/Adafruit-Pi-ExternalRoot-Helper.git</code></li>
|
||||
</ul></li>
|
||||
<li>Simply ran the script in the directory <code>Adafruit-Pi-ExternalRoot-Helper</code>
|
||||
<ul>
|
||||
<li><code>cd Adafruit-Pi-ExternalRoot-Helper</code></li>
|
||||
<li><code>sudo ./adafruit-pi-externalroot-helper -d /dev/sda</code></li>
|
||||
</ul></li>
|
||||
<li>Rebooted the Pi and all was done</li>
|
||||
</ul>
|
||||
<h3 id="what-the-script-does">What the script does</h3>
|
||||
<p>The script <code>adafruit-pi-externalroot-helper</code> is a Bash script and is clearly written. It needs to be run as <code>root</code> since it performs low-level actions.</p>
|
||||
<p>In case you are interested in what the script actually does, I have described it here. It is made available under an MIT licence, so I have <a href="hpr2023_adafruit-pi-externalroot-helper.txt" title="adafruit-pi-externalroot-helper">included a copy</a> on the HPR website so that you can view it as you listen or as you read these notes.</p>
|
||||
<p>If you are not interested then you can skip to the next section of course.</p>
|
||||
<ul>
|
||||
<li>The script starts by ensuring that the necessary packages have been installed, using <code>apt-get</code> to install them: <code>gdisk</code>, <code>rsync</code> and <code>parted</code>.</li>
|
||||
<li>It then uses <code>parted</code> (which I didn't know about) to make a "<em>gpt</em>" partition table, then to make a primary partition of type "<em>ext4</em>" occupying the entire disk.</li>
|
||||
<li>Then it uses <code>mkfs</code> to make an <em>ext4</em> file system labelled "<em>rootfs</em>" on this partition.</li>
|
||||
<li>Next it uses <code>blkid</code> to find the UUID for the partition.
|
||||
<ul>
|
||||
<li>This tool when called in this way returns a list of values in the format <em>key=value</em>.</li>
|
||||
<li>The script uses an <code>eval</code> call with the <code>blkid</code> command in a command substitution so that these keys and values create variables in the environment.</li>
|
||||
<li>Since there is a line "UUID=<em>value</em>" in the output (amongst others) a variable of that name will be created with the value for the partition.</li>
|
||||
<li>The result is stored in a variable <code>target_partition_uuid</code></li>
|
||||
</ul></li>
|
||||
<li>The script then collects the "Partition unique GUID" from the device, since this is needed to make the boot sequence use the external disk rather than the SD card.
|
||||
<ul>
|
||||
<li>It does this by echoing the 'i' command (<em>partition information</em>) to <code>gdisk</code>, running against the device, not the partition.</li>
|
||||
<li>In the output there is a line beginning with "Partition unique GUID:" which is searched for with <code>grep</code> and the 4th element (GUID) is extracted with <code>awk</code>.</li>
|
||||
<li>The result of all of this is that a variable <code>partition_unique_guid</code> is set to the GUID.</li>
|
||||
</ul></li>
|
||||
<li>The script reports the UID and GUID values it has collected.</li>
|
||||
<li>Next it mounts the partition on a mount point called <code>/mnt</code>.</li>
|
||||
<li>Having done that it uses <code>rsync</code> to copy everything under the root directory (<code>/</code>) on the SD card to <code>/mnt</code>, the external disk. This is not a quick process since SD cards are not particularly quick.</li>
|
||||
<li>Now the script edits the file <code>/boot/cmdline.txt</code> having first made a backup copy in <code>/boot/cmdline.txt.bak</code>.
|
||||
<ul>
|
||||
<li>Since it's using <code>sed</code> to do the edit it could have achieved that all in the same command (as you'll know if you've been following my <code>sed</code> series!!). However, doing it this way might be slightly safer if the <code>sed</code> command fails for whatever reason.</li>
|
||||
<li>The <code>sed</code> command changes the definition of the root device in <code>boot/cmdline.txt</code> to the disk rather than the SD card and sets a <code>rootdelay=5</code> value to delay 5 seconds for the disk to become ready.</li>
|
||||
<li>The '<em>-i</em>' <code>sed</code> command line option is used to perform the edit in-place. The script could have generated a backup at this point of course.</li>
|
||||
<li>Note that the <code>sed</code> command is enclosed in double quotes. This allows Bash to substitute in the value of the <code>partition_unique_guid</code> variable.</li>
|
||||
<li>Note also that the author escapes the slashes in the '<strong>s</strong>' command where this is not necessary because '|' has been used as a delimiter.</li>
|
||||
</ul></li>
|
||||
<li>Next the script edits the copied <code>/etc/fstab</code> (currently under <code>/mnt</code>) to mount the external disk as <code>/</code> rather than the SD card.
|
||||
<ul>
|
||||
<li>It runs <code>sed</code> to find the line containing the SD card partition and comments it out.</li>
|
||||
<li>It then appends a line to the file with a new mount point using the UUID collected earlier.</li>
|
||||
</ul></li>
|
||||
<li>Now all is complete and the user is prompted to check what has been done before rebooting the Pi.</li>
|
||||
</ul>
|
||||
<p>I saved <a href="hpr2023_session_log.txt" title="Transcript of running the script">the transcript of what went on</a> when I ran this script and have made it available on the HPR site in case it is useful to anyone.</p>
|
||||
<h3 id="reverting-to-the-sd-card">Reverting to the SD card</h3>
|
||||
<p>Since all that has changed on the SD card is the file <code>/boot/cmdline.txt</code>, and we have a backup, reversion can be achieved by replacing the changed file with the backup. Note that any updates and additions made on the external disk will not be available any more and will need to be re-applied or copied to the SD card if you do this.</p>
|
||||
<h2 id="picture">Picture</h2>
|
||||
<figure>
|
||||
<img src="hpr2023_RPi_server_collection.png" alt="My collection of Raspberry Pi servers" /><figcaption>My collection of Raspberry Pi servers</figcaption>
|
||||
</figure>
|
||||
<h2 id="epilogue">Epilogue</h2>
|
||||
<p>Only after writing and recording this show did I notice that the <a href="https://learn.adafruit.com/external-drive-as-raspberry-pi-root/what-the-helper-script-does" title="What the Helper Script Does">Adafruit article actually describes what the script does</a>. It is better than my description in some ways, but doesn't cover some of the things I did.</p>
|
||||
<p>It's a typical case of me being in too much of a hurry to do a proper job I'm afraid!</p>
|
||||
<h2 id="links">Links</h2>
|
||||
<ul>
|
||||
<li>Pimoroni Pibow 3: <a href="https://shop.pimoroni.com/products/pibow-for-raspberry-pi-3" class="uri">https://shop.pimoroni.com/products/pibow-for-raspberry-pi-3</a></li>
|
||||
<li>Raspberry Pi Universal Power Supply: <a href="https://shop.pimoroni.com/products/raspberry-pi-universal-power-supply" class="uri">https://shop.pimoroni.com/products/raspberry-pi-universal-power-supply</a></li>
|
||||
<li>Raspberry Pi 3 Heatsink: <a href="https://shop.pimoroni.com/products/heatsink" class="uri">https://shop.pimoroni.com/products/heatsink</a></li>
|
||||
<li>SATA Hard Drive to USB Adapter: <a href="https://shop.pimoroni.com/products/sata-hard-drive-to-usb-adapter" class="uri">https://shop.pimoroni.com/products/sata-hard-drive-to-usb-adapter</a></li>
|
||||
<li>SanDisk SSD PLUS 120 GB Sata III 2.5-inch Internal SSD: <a href="http://www.amazon.co.uk/SanDisk-PLUS-Sata-2-5-inch-Internal/dp/B00S9Q9UKS" class="uri">http://www.amazon.co.uk/SanDisk-PLUS-Sata-2-5-inch-Internal/dp/B00S9Q9UKS</a></li>
|
||||
<li>Kingston Flash Memory Card 32 GB: <a href="http://www.amazon.co.uk/Kingston-Class10-microSDHC-Include-Adapter/dp/B0162YQG2I" class="uri">http://www.amazon.co.uk/Kingston-Class10-microSDHC-Include-Adapter/dp/B0162YQG2I</a></li>
|
||||
<li>FLIRC Raspberry Pi 2/3 Case: <a href="https://thepihut.com/products/flirc-raspberry-pi-3-b-case" class="uri">https://thepihut.com/products/flirc-raspberry-pi-3-b-case</a></li>
|
||||
<li>Adafruit tutorial "<em>Using an External Drive as a Raspberry Pi Root Filesystem</em>": <a href="https://learn.adafruit.com/external-drive-as-raspberry-pi-root/overview" class="uri">https://learn.adafruit.com/external-drive-as-raspberry-pi-root/overview</a></li>
|
||||
<li>Article by paulv on the Raspberry Pi forums - "<em>HOWTO: Move the filesystem to a USB stick/Drive</em>": <a href="https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177" class="uri">https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177</a></li>
|
||||
<li>Copy of <code>adafruit-pi-externalroot-helper</code> script: <a href="hpr2023_adafruit-pi-externalroot-helper.txt" class="uri">hpr2023_adafruit-pi-externalroot-helper.txt</a></li>
|
||||
<li>Transcript of what happened when I ran the script: <a href="hpr2023_session_log.txt" class="uri">hpr2023_session_log.txt</a></li>
|
||||
</ul>
|
||||
<!--
|
||||
vim: syntax=markdown:ts=8:sw=4:ai:et:tw=78:fo=tcqn:fdm=marker
|
||||
-->
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
65
www/eps/hpr2023/hpr2023_session_log.txt
Executable file
65
www/eps/hpr2023/hpr2023_session_log.txt
Executable file
@@ -0,0 +1,65 @@
|
||||
dave@rpi5:~ $ git clone https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git
|
||||
Cloning into 'Adafruit-Pi-ExternalRoot-Helper'...
|
||||
remote: Counting objects: 53, done.
|
||||
remote: Total 53 (delta 0), reused 0 (delta 0), pack-reused 53
|
||||
Unpacking objects: 100% (53/53), done.
|
||||
Checking connectivity... done.
|
||||
|
||||
dave@rpi5:~/Adafruit-Pi-ExternalRoot-Helper $ sudo su -
|
||||
[sudo] password for dave:
|
||||
root@rpi5:~# cd ~dave/Adafruit-Pi-ExternalRoot-Helper/
|
||||
root@rpi5:/home/dave/Adafruit-Pi-ExternalRoot-Helper# ./adafruit-pi-externalroot-helper -d /dev/sda
|
||||
Target drive = /dev/sda
|
||||
[start] Will create new ext4 filesystem on /dev/sda
|
||||
[start] If there is data on /dev/sda, it will be lost.
|
||||
Really proceed? (y)es / (n)o y
|
||||
[dependencies] Installing gdisk, rsync, and parted.
|
||||
Reading package lists... Done
|
||||
Building dependency tree
|
||||
Reading state information... Done
|
||||
parted is already the newest version.
|
||||
rsync is already the newest version.
|
||||
rsync set to manually installed.
|
||||
The following NEW packages will be installed:
|
||||
gdisk
|
||||
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
|
||||
Need to get 193 kB of archives.
|
||||
After this operation, 799 kB of additional disk space will be used.
|
||||
Do you want to continue? [Y/n]
|
||||
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main gdisk armhf 0.8.10-2 [193 kB]
|
||||
Fetched 193 kB in 0s (321 kB/s)
|
||||
Selecting previously unselected package gdisk.
|
||||
(Reading database ... 127195 files and directories currently installed.)
|
||||
Preparing to unpack .../gdisk_0.8.10-2_armhf.deb ...
|
||||
Unpacking gdisk (0.8.10-2) ...
|
||||
Processing triggers for man-db (2.7.0.2-5) ...
|
||||
Setting up gdisk (0.8.10-2) ...
|
||||
[fs create] Creating /dev/sda1
|
||||
[fs create] Creating ext4 filesystem on /dev/sda1
|
||||
mke2fs 1.42.12 (29-Aug-2014)
|
||||
Creating filesystem with 29304832 4k blocks and 7331840 inodes
|
||||
Filesystem UUID: 08fcdeb6-7df7-4aeb-a21b-c48438cfb828
|
||||
Superblock backups stored on blocks:
|
||||
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
|
||||
4096000, 7962624, 11239424, 20480000, 23887872
|
||||
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Creating journal (32768 blocks): done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
[fs id] Getting UUID for target partition
|
||||
[fs id] Getting Partition unique GUID for target filesystem
|
||||
[fs id] Target partition UUID: 08fcdeb6-7df7-4aeb-a21b-c48438cfb828
|
||||
[fs id] Partition unique GUID: 6F8E0B29-6C85-490F-A316-1092BC2A7D86
|
||||
[fs copy] Mounting /dev/sda1 on /mnt
|
||||
[fs copy] Copying root filesystem to /dev/sda1 with rsync
|
||||
[fs copy] This will take quite a while. Please be patient!
|
||||
[boot config] Configuring boot from {/dev/sda1}
|
||||
[boot config] Commenting out old root partition in /etc/fstab, adding new one
|
||||
[boot config] Ok, your system should be ready. You may wish to check:
|
||||
[boot config] /mnt/etc/fstab
|
||||
[boot config] /boot/cmdline.txt
|
||||
[boot config] Your new root drive is currently accessible under /mnt.
|
||||
[boot config] In order to restart with this drive at /, please type:
|
||||
[boot config] sudo reboot
|
||||
Reference in New Issue
Block a user