Pages

Monday, 11 November 2013

Running Ubuntu off USB hard drive on Beaglebone Black

This is how i setup the BBB to run of a USB hard drive (i hate it when the SD-card is killed).

I got my inspiration from The Raspberry Pi Hobbyist and The EmbeddedHobbyist
The first is obviously not for BBB (but Linux is Linux) and the second one didn't really make any sense to me =)

First flash the BBB with Ubuntu using the instruction found on Circuitco homepage.
But unfortunately the direct link to the image is broken, this is the image i used: BBB-eMMC-flasher-ubu...

When flashing is done, remove SD-card and reboot the BBB

After that i logged on to the BBB and became root (username: ubuntu password: temppwd):
#sudo su (bad practice, i know but I'm lazy)

Next partition the hard drive (make sure you know what you're doing here)
#fdisk /dev/sda

Delete any old partitions using d.

Create new partitions with n

I made 3 partitions, 1 for the OS (20 GB), 1 swap (2 GB) and 1 for data (whatever left), in fdisk it looked like this:

OS Partition:
  n                   (new)
  p                   (primary)
  <enter>        (first available)
  <enter>        (start from first available sector)
  +20G           (make the size 20GB)
  a                  (toggle bootable flag)
  1                  (partition 1)

Swap partition:
  n                   (new)
  p                   (primary)
  <enter>        (first available)
  <enter>        (start from first available sector)
  +2G             (make the size 2GB)
  t                   (change partition type)
  2                  (partition 2)
  82                (Linux swap)

Data partition
  n                   (new)
  p                   (primary)
  <enter>        (first available)
  <enter>        (start from first available sector)
  <enter>        (last sector available)

Now were almost done, use p to list the new partition table and it should look something like this:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    41945087    20971520   83  Linux
/dev/sda2        41945088    46139391     2097152   82  Linux swap / Solaris

/dev/sda3        46139392   312581807   133221208   83  Linux

Exit fdisk saving the changes by pressing w and enter.

Next prepare the swap partition:
#mkswap /dev/sda2

Format the data partition:
#mkfs.ext4 /dev/sda3

Copy the rootfs from eMMC to the first partition (assuming /dev/mmvblk0p2 is your current root, you can check this by using the mount command):
#dd if=/dev/mmcblk0p2 of=/dev/sda1 bs=32M conv=noerror,sync

After dd is complete, check the filesystem (-f for force check and -y for yes to all questions):
#e2fschck -fy /dev/sda1

Next, resize the filesystem to match the partition:
#resize2fs /dev/sda1

Now its time to make some changes to our rootfs to be, start with mounting /dev/sda1:
#mount /dev/sda1 /mnt

Copy the kernel, uboot etc to the hard drive:
#cp -pvrf /boot/* /mnt/boot

And at last, change the uEnv.txt om the eMMC (not the hard drive)
#nano /boot/uboot/uEnv.txt

Find the line looking like this:
mmcroot=UUID=9363f4b4-869d-48ae-861e-80b18fc1a734 ro
Change it to look like this:
mmcroot=/dev/sda1 ro


Save and quit nano.
Make sure everything is saved:
#sync

Reboot and hold thumbs =)

If the system boots correctly, log in and make sure were running from hdd:
#mount

Look for the line:
/dev/sda1 on / type ext4 (rw)

4 comments:

  1. as did mine... thanks a bunch

    ReplyDelete
  2. With the advancements in IT industry, the means of marketing have also faced a lot of changes. Nowadays, everything that is used by people can be used as a medium for promoting the business and company. One of the best products which people use in their daily lives is USB drives.custom flash drives

    ReplyDelete
  3. I go to see each day a few web pages and websites to read articles, except this website gives quality based writing. all of craigslist

    ReplyDelete