• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Booting entirely off an external USB device  (Read 8410 times)
wstupar
Newbie
*

Karma: 0
Posts: 33


View Profile
« on: July 06, 2009, 08:47:01 AM »

I am following the wiki for the subject, http://www.computingplugs.com/index.php/Booting_entirely_off_an_external_USB_device.

When I try to mount the file system from nand I get this failure:

root@ubuntu:~# mount /dev/mtdblock1 /mnt/mtdroot
VFS: Can't find ext4 filesystem on dev mtdblock1.
FAT: bogus number of FAT structure
mount: you must specify the filesystem type

So I try this:

root@ubuntu:~# mount -t ext2 /dev/mtdblock1 /mnt/mtdroot
mount: wrong fs type, bad option, bad superblock on /dev/mtdblock1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

I am working on a plug that was restored using the installer http://www.openplug.org/plugwiki/index.php/SheevaPlug_Installer

Why can't I mount the file system?

Wes
Logged

rc3
Newbie
*

Karma: 0
Posts: 36


View Profile
« Reply #1 on: July 06, 2009, 02:44:36 PM »

Have you tried
Quote
mount -t jffs2 /dev/mtdblock1 /mnt/mtdroot
?
Logged

wstupar
Newbie
*

Karma: 0
Posts: 33


View Profile
« Reply #2 on: July 06, 2009, 03:26:05 PM »

Well at least it recognizes the file system, but:

root@ubuntu:~# mount -t jffs2 /dev/mtdblock1 /mnt/mtdroot
mount: /dev/mtdblock1: can't read superblock
root@ubuntu:~#

It churned around for awhile to get to this failure.
Logged

wstupar
Newbie
*

Karma: 0
Posts: 33


View Profile
« Reply #3 on: July 06, 2009, 03:57:30 PM »

But it seems to mount as sysfs:

root@ubuntu:~# mount -t sysfs /dev/mtdblock1 /mnt/mtdroot
root@ubuntu:~# ls -l /mnt/mtdroot
total 0
drwxr-xr-x  2 root root 0 Jul  6 22:55 block
drwxr-xr-x 13 root root 0 Jul  6 22:55 bus
drwxr-xr-x 31 root root 0 Jul  6 22:55 class
drwxr-xr-x  4 root root 0 Jul  6 22:55 dev
drwxr-xr-x  5 root root 0 Jul  6 22:55 devices
drwxr-xr-x  2 root root 0 Jul  6 22:55 firmware
drwxr-xr-x  3 root root 0 Jul  6 22:55 fs
drwxr-xr-x  5 root root 0 Jul  6 22:55 kernel
drwxr-xr-x 31 root root 0 Jul  6 22:55 module

Thanks for pointing me in the right direction.
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #4 on: July 06, 2009, 05:22:47 PM »

But it seems to mount as sysfs:
  root@ubuntu:~# mount -t sysfs /dev/mtdblock1 /mnt/mtdroot
Probably not.  That has just mounted sysfs onto /mnt/mtdroot - it hasn't mounted /dev/mtdblock1, so you aren't seeing its contents.  sysfs is a way to export the kernel datastructures to userspace.  It just ignores the device option to the mount command.
Logged

semery
Newbie
*

Karma: 0
Posts: 13


View Profile
« Reply #5 on: July 06, 2009, 06:17:47 PM »

From the "README.txt" in the "installer" directory in the installer.

Quote
This is an installer for Ubuntu image to /dev/mtdblock1 on the internal NAND flash as UBIFS.

I'm thinking you need to mount /dev/mtdblock1 as UBIFS. I'm not sure how to do that. The kernel I'm running is supposed to have UBIFS support but I always get the following when I try:
Code:
sudo mount -t ubifs ubi0:rootfs /mnt/nand/
mount: unknown filesystem type 'ubifs'

Hopefully this might be of help.
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #6 on: July 06, 2009, 07:20:28 PM »

How to mount the NAND as a ubifs fs interests me, too.  I'm thinking that you'll need to set up the UBI layer first, although I haven't played around with this.  However, the following URL is intriguing, if you want to do some more experimenting:

http://www.linux-mtd.infradead.org/faq/ubi.html

Still, the error message from mount doesn't sound all that promising -- it sounds like some ubifs code is missing, although this same kernel boots fine  and mounts it correctly when set-up to use the NAND as its root fs.

If you do fiddle with this some more, let us know how it comes out.
Logged

semery
Newbie
*

Karma: 0
Posts: 13


View Profile
« Reply #7 on: July 07, 2009, 11:33:25 AM »

A little more digging and with the help of the link you provided I managed to get the internal device to mount. It is in the wiki but it's buried in another topic. http://www.plugcomputer.org/plugwiki/index.php/Enabling_UBIFS#Why_UBIFS_instead_of_JFFS2.3F I'll walk through it in a bit more detail just for fun.

First, make sure you have a kernel with UBI support. I imagine if you used the Installer you're running one of cbxbiker61's excellent kernels which has the support built in.

Next, you should be able to see the mtd devices in the plug by executing:
Code:
root@sheeva:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00400000 00020000 "uImage"
mtd1: 1fb00000 00020000 "rootfs"

We see that my "rootfs" on the nand is on mtd1. Now we need to attach the mtd device. This can be done in a number of ways. One way is to do it in the kernel parameters at boot time but I find the ubiattach utility the easiest. See more info here: http://www.linux-mtd.infradead.org/faq/ubi.html#L_attachmtd To attach mtd1 to ubi device 0, use:
Code:
root@sheeva:~# ubiattach /dev/ubi_ctrl -m 1 -d 0
UBI device number 0, total 4055 LEBs (523192320 bytes, 499.0 MiB), available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)

The dmesg output after running the above command should look something like this:
Code:
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "rootfs"
UBI: MTD device size:            507 MiB
UBI: number of good PEBs:        4055
UBI: number of bad PEBs:         1
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 4055
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 3/0
UBI: background thread "ubi_bgt0d" started, PID 22880

Now that the device is attached (you should see /dev/ubi0 and /dev/ubi0_0 entries if you ran the above code), we can mount it with:
Code:
root@sheeva:~# mount -t ubifs ubi0_0 /mnt/nand
OR
Code:
root@sheeva:~# mount -t ubifs ubi0:rootfs /mnt/nand
I prefer the second one as it is easier to read.

Finally, you can unmount with:
Code:
root@sheeva:~# umount ubi0:rootfs

And detach ubi device 0 with:
Code:
root@sheeva:~# ubidetach /dev/ubi_ctrl -d 0

Cheers!
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #8 on: July 07, 2009, 01:09:22 PM »

Thanks for taking the time to figure it out and post your results, semery.  I've bookmarked your post.
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #9 on: August 17, 2009, 07:50:22 AM »

Thanks for taking the time to figure it out and post your results, semery.  I've bookmarked your post.
restamp, how do you mookmark a post?  Inside the forum or you are using your bwosers bookarking?
Logged

Cordially, CqCn

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #10 on: August 17, 2009, 08:07:37 AM »

Just in my browser.  Click on the title first -- for example, to bookmark semery's post, I click on it's title, yielding http://plugcomputer.org/plugforum/index.php?topic=478.msg2838#msg2838 -- and then bookmark it according to however your browser does so.
Logged

Pages: [1]
Print
Jump to: