Difference between revisions of "Mounting Root File System on External USB Drive"

From odroid US
Jump to: navigation, search
(Prepare the External Drive)
Line 16: Line 16:
 
Here we see the drive designator is /dev/sdc  It happens to be formatted already, that is why we see the sdc1.
 
Here we see the drive designator is /dev/sdc  It happens to be formatted already, that is why we see the sdc1.
  
 +
<pre>
 
[1554360.507662] sd 21:0:0:0: [sdc] Mode Sense: 23 00 00 00
 
[1554360.507662] sd 21:0:0:0: [sdc] Mode Sense: 23 00 00 00
 
[1554360.508252] sd 21:0:0:0: [sdc] No Caching mode page present
 
[1554360.508252] sd 21:0:0:0: [sdc] No Caching mode page present
Line 26: Line 27:
 
[1554360.542415] sd 21:0:0:0: [sdc] Attached SCSI removable disk
 
[1554360.542415] sd 21:0:0:0: [sdc] Attached SCSI removable disk
 
[1554361.651882] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
 
[1554361.651882] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
 +
</pre>
  
 
For explaination purposes, I going to use sdX to you don't accidentally copy/paste the example instructions into your console and wreck your host.
 
For explaination purposes, I going to use sdX to you don't accidentally copy/paste the example instructions into your console and wreck your host.

Revision as of 03:29, 1 February 2013

THIS TUTORIAL IS NOT COMPLETE. PLEASE DON'T EDIT IT.

This tutorial shows how to mount your root file system on an external USB drive. It could be either a USB Hard Drive or a Thumb Drive.

Prepare the External Drive

Format the drive with an ext 4 file system and write a root file system image to it. For help in handling root file system images, please see Updating from Root File System Images.

There are many tools you might use to format the drive, but you need to be careful not to distroy any host drive.

Plug the drive into your Linux host, then use dmesg to see which drive designator is used.

dmesg | tail -n 10

Here we see the drive designator is /dev/sdc It happens to be formatted already, that is why we see the sdc1.

[1554360.507662] sd 21:0:0:0: [sdc] Mode Sense: 23 00 00 00
[1554360.508252] sd 21:0:0:0: [sdc] No Caching mode page present
[1554360.508256] sd 21:0:0:0: [sdc] Assuming drive cache: write through
[1554360.512161] sd 21:0:0:0: [sdc] No Caching mode page present
[1554360.512165] sd 21:0:0:0: [sdc] Assuming drive cache: write through
[1554360.539551]  sdc: sdc1
[1554360.542408] sd 21:0:0:0: [sdc] No Caching mode page present
[1554360.542412] sd 21:0:0:0: [sdc] Assuming drive cache: write through
[1554360.542415] sd 21:0:0:0: [sdc] Attached SCSI removable disk
[1554361.651882] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)

For explaination purposes, I going to use sdX to you don't accidentally copy/paste the example instructions into your console and wreck your host.

Unmount the drive, just in case it was automounted.

sudo umount /dev/sdX*

Format the drive with ext4 layout

sudo mkfs.ext4 /dev/sdc1

We just created one partition taking up the whole external drive

Get a Root File System Image

If you don't have one, get one. This example gets a Debian Wheezy system that is set up to do native builds.

wget http://odroid.us/odroid/odroidu2/debian/odroidu2_20130104-debian-wheezy-devel-4-rootfs.tgz
wget http://odroid.us/odroid/odroidu2/debian/odroidu2_20130104-debian-wheezy-devel-4-rootfs.tgz.md5sum
md5sum -c odroidu2_20130104-debian-wheezy-devel-4-rootfs.tgz.md5sum

odroidu2_20130104-debian-wheezy-devel-4-rootfs.tgz: OK The md5sum checked OK.

Expand a root file system tarball to the external drive

mkdir mnt
sudo mount /dev/sdX1 mnt
cd mnt
sudo tar -xvzf ../odroidu2_20130104-debian-wheezy-devel-4-rootfs.tgz
cd ../
sync
sudo umount mnt


Mount the boot partition on the Odroid-U2

Mount the boot partition and move into it. Some root file systems will already have /boot mounted, if so you can skip the mount step. No harm done if you mount again.

mkdir /boot >/dev/null 2>&1
mount /dev/mmcblkp1 /boot
cd /boot


Download Example Files to the Odroid-U2

# Do this on the odroid
cd /boot
# Get the example files
wget http://odroid.us/odroid/users/osterluk/rfs-on-external-drive/rfs-on-external-drive.tgz
wget http://odroid.us/odroid/users/osterluk/rfs-on-external-drive/rfs-on-external-drive.tgz.md5sum
md5sum -c rfs-on-external-drive.tgz.md5sum
# Assuming the md5sum is correct, continue
tar -xvf rfs-on-external-drive.tgz
# copy existing boot script so you can switch back
cp boot.scr boot.scr.orig
# replace the existing script with the one that mounts the external drive
cp boot-thumb.scr boot.scr
sync


Move the USB drive to the odroid and reboot.