Reinstallation
At some point an Arch Linux ARM installation may need to be either recreated or moved to the existing or new media that is being used for the root filesystem. This is a simple and straightforward task that can be accomplished from any Linux computer, or from a live CD/USB or virtual machine of the distribution of your choice. The instructions below cover both reinstalling from scratch and moving an existing installation. For moving an installation to a new drive, follow steps 1, 2, and 3 using the drive you are moving your installation to; not the existing drive.
1. Identify the drive to install to
This is important so that you do not end up formatting some other drive on your system. Since all of the other steps will require you become root, do so at this time. Open a console/terminal emulator for this if you are in a graphical desktop.
For Ubuntu systems and derivatives, type:
sudo su
For just about every other distribution, type:
su
If you are using a live CD, there is likely no root password or one has been provided for you. You should become root with either of those commands. Otherwise, you will be asked to provide your root password. You will know you are root by looking at your prompt. For regular users, your prompt will end in a dollar sign ($), and for root a number sign (#).
At this point, plug in the target drive. Wait a few moments, then type:
dmesg | tail
This will give you output that will look similar to the following:
[862401.693536] sd 2:0:0:0: [sdb] Write Protect is off
[862401.693548] sd 2:0:0:0: [sdb] Mode Sense: 45 00 00 08
[862401.700884] sdb: sdb1
[862401.705538] sd 2:0:0:0: [sdb] No Caching mode page present
[862401.705551] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[862401.705562] sd 2:0:0:0: [sdb] Attached SCSI removable disk
This tells you that the drive you have attached has been assigned the designation /dev/sdb, and that the drive has a single partition /dev/sdb1. If you are moving an installation to another drive, repeat the same procedure to identify the second drive. Take note of what the device names are. From this point forward the device name /dev/sdx will be used in this guide to identify the target drive, replace instances of it with your drive designation.
2. Partition the drive
This step can be skipped and you can move to step 3 if the partition layout from a previous Arch Linux ARM install is still intact. These are the same steps you'll find on the installation pages. This procedure will create one partition that fills the entire disk.
Start fdisk to partition the drive:
fdisk /dev/sdx
At the fdisk prompt, delete old partitions and create a new one:
- Type o. This will clear out any partitions on the drive.
- Type p to list partitions. There should be no partitions left.
- Now type n, then p for primary, 1 for the first partition on the drive, and then press ENTER, accepting default values.
- Exit by typing w.
If you have a GoFlex Net/Home device, you will additionally need to label the partition:
tune2fs -L "rootfs" /dev/sdx1
3. Format the drive
This procedure will format the partition that was created in step 2 or already exists with the ext3 filesystem. This is the recommended filesystem to use.
To format the partition, type:
mkfs.ext3 /dev/sdx1
4A. Mount the drive, download and extract the root filesystem
For reinstallation from scratch, follow this step. For migrating to a new drive see step 4B.
Visit either your device's installation page or the Downloads page to get the link to download the latest root filesystem tarball for your device.
Create a temporary directory and mount the target drive:
cd /tmp
mkdir alarm
mount /dev/sdx1 alarm
cd alarm
Download and extract the root filesystem, replacing the URL with the one you obtained earlier:
wget http://archlinuxarm.org/os/ArchLinuxARM-PLATFORM-latest.tar.gz
tar -zxf ArchLinuxARM-PLATFORM-latest.tar.gz
After it's done extracting, safely unmount the drive:
cd ..
umount alarm
The umount command may take a few moments to complete as buffers are flushed to the disk. At this point the installation is complete, and the drive can be removed from the computer and attached to the powered-off device. Power it on and it should boot up.
4B. Migrating from an old drive
Having followed steps 1, 2, and 3 for the new drive, and having identified the old drive as well in step 1, follow this step to migrate files from your previous installation. For these steps, /dev/sdx will refer to the new drive you are moving to, with /dev/sdy referring to the old drive you are moving from. It is also assumed that the installation is on the first partition of both drives, adjust the commands if necessary to your setup.
Create two temporary directories and mount both drives:
cd /tmp
mkdir old
mount /dev/sdy1 old
mkdir new
mount /dev/sdx1 new
Copy the files from the old installation to the new drive, then unmount both drives:
cp -a old/* new
umount old
umount new
The umount command may take a few moments to complete as buffers are flushed to the disk. At this point the move is complete, and drives can be removed from the computer and the new drive attached to the powered-off device. Power it on and it should boot up.