• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1] 2 3
Author Topic: SD root filesystem flies!  (Read 11956 times)
cbxbiker61
Global Moderator
Sr. Member
*****

Karma: 38
Posts: 497


View Profile
« on: April 24, 2009, 01:10:38 AM »

All I can say is wow.  When you move your root filesystem to SD it is way fast compared to JFFS2.  It moves wear and tear off your Flash to replaceable SD.  It's beautiful that you could pop out the SD from a SheevaPlug, pop it into an SD reader on a standard machine and create a duplicate SheevaPlug install in minutes.  I'm using an 8Gig SD formatted with EXT2.  My theory is that journaling filesystems such as EXT3, EXT4, JFS, XFS create undo wear on flash media.  So I stick with plain 'ol EXT2 with noatime specified in fstab.

All you need to do is:

"cp -ax / /Whereever/SdIsMounted"
In U-Boot change boot_args to "root=/dev/mmcblk0p1".
Logged

dg
Newbie
*

Karma: 0
Posts: 14


View Profile
« Reply #1 on: April 24, 2009, 06:07:02 AM »

The SD card is actually quite slow --- I get 8MB/s read off a Kingston Class 6 SD card. USB is a lot faster; anthing from 15 to 30MB/s, and I'm working on an experimental technique for getting 40MB/s!
Logged

cbxbiker61
Global Moderator
Sr. Member
*****

Karma: 38
Posts: 497


View Profile
« Reply #2 on: April 24, 2009, 06:22:25 AM »

I agree that SD isn't as fast as USB on the Sheeva.  I did some testing with results similar to yours.  The interesting thing is that even though SD isn't as fast as USB, it's still WAY faster than JFFS2 running from flash.

Right now I'm running with an SD root and a USB /home, which is a nice combo for a development Sheeva.
Logged

KaiBo
Newbie
*

Karma: 0
Posts: 35



View Profile
« Reply #3 on: April 25, 2009, 06:21:38 PM »

All you need to do is:

"cp -ax / /Whereever/SdIsMounted"
In U-Boot change boot_args to "root=/dev/mmcblk0p1".
You do not use an SDHC-card, do you? I have been messing around with this now several times and as of my latest efforts I am stuck with this not-so-nice-line on my 8GB-card (2GB works fine):
Code:
mmc0: error -110 whilst initialising SD card
There is a solution for something similar by passing sdhci debug_quirks=1 to the module - but how do you do that when you have the support compiled into kernel?
Logged

wb6ymh
Newbie
*

Karma: 0
Posts: 18


View Profile
« Reply #4 on: April 25, 2009, 06:27:45 PM »

I'm not having any luck with my 2gig card.  It boots ok, but then ends up with
Code:
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new high speed SD card at address 0002
mmcblk0: mmc0:0002 SD2GB 2009088KiB
 mmcblk0: p1
eth0: link down
eth0: started
IP-Config: Gateway not on directly connected network.
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
kjournald starting.  Commit interval 5 seconds
EXT3 FS on mmcblk0p1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem).
Freeing init memory: 104K
Warning: unable to open an initial console.
eth0: link up, full duplex, speed 100 Mbps
I can't ssh in either - connection refused.  Ideas?  I've fsck'ed the thing and it's clean.

Maybe it'll be fast in use, it sure took forever to mkfs it and copy the initial contents.

Skip
Logged

KaiBo
Newbie
*

Karma: 0
Posts: 35



View Profile
« Reply #5 on: April 25, 2009, 07:00:20 PM »

I figured my one out by compiling SDHCI-Support into the kernel.....  Roll Eyes

Regarding your problem, do you have /dev/ttyS0?
Logged

wb6ymh
Newbie
*

Karma: 0
Posts: 18


View Profile
« Reply #6 on: April 25, 2009, 08:15:08 PM »

Quote
Regarding your problem, do you have /dev/ttyS0?
Well /dev is a udev filesystem so no I don't have a /dev/ttyS0 in the flash itself, but I do have the mount point.

/etc/fstab looks like this
Code:
# UNCONFIGURED FSTAB FOR BASE SYSTEM
tmpfs /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
/proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
varrun /var/run tmpfs rw,nosuid,mode=0755 0 0
varlock /var/lock tmpfs rw,noexec,nosuid,nodev,mode=1777 0 0
udev /dev tmpfs rw,mode=0755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=620 0 0
/dev/mmcblk0p1 / ext3 rw 0 0
tmpfs   /var/cache/apt  tmpfs   defaults,noatime

Skip
Logged

cbxbiker61
Global Moderator
Sr. Member
*****

Karma: 38
Posts: 497


View Profile
« Reply #7 on: April 25, 2009, 09:46:10 PM »

Quote
Well /dev is a udev filesystem so no I don't have a /dev/ttyS0 in the flash itself, but I do have the mount point.

That would be a problem.  It has to have a limited set of device drivers in /dev (including ttyS0) when the kernel boots.  The kernel needs ttyS0 BEFORE udev is started.
Logged

wb6ymh
Newbie
*

Karma: 0
Posts: 18


View Profile
« Reply #8 on: April 25, 2009, 11:15:30 PM »

Ah!  So when I did the "cp -ax / /Whereever/SdIsMounted" on a running system to
create my mmc image nothing was populated in /dev because it has been overlayed
by the udev filesystem by that time.  I populated my /dev/ directory and that fixed
the problem!  Thanks!  I sure seems obvious now, but it hasn't been for last 4 hours!

So
All you need to do is:

"cp -ax / /Whereever/SdIsMounted"
In U-Boot change boot_args to "root=/dev/mmcblk0p1".
and then
Code:
"cp -a /dev /Whereever/SdIsMounted/dev

That probably picks up way more than is needed, but at least it boots!

Skip
Logged

Sethlans
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #9 on: May 17, 2009, 04:00:11 PM »

edit: problem solved, it was my mistake D:
« Last Edit: May 17, 2009, 09:30:19 PM by Sethlans » Logged

loonsailor
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #10 on: May 23, 2009, 09:14:18 PM »

I can't get this to work.  I've got everything copied to my SD card, by the following:

>mkfs -t ext3 /dev/mmcblk0
>mount /dev/mmcblk0 /sdcard
>cp -ax / /sdcard
>cp -a /dev /sdcard/dev


/sdcard looks fine.  But I can't figure out how to boot using it as the rootfs.  I tried to make the change suggested by entering, in u-boot:

>setenv boot_args root=/dev/mmcblk0p0

When I do a "printenv", I see two different bootarg lines:

bootargs_root=root=/dev/mtdblock2 ro
...and...
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none


and also my new boot_args line.  When I boot, it gets to the "uncompressing linux.... done, booting the kernel." and then goes away for good.  I also tried

>setenv bootargs root=/dev/mmcblk0

with the same result.  I'm using the original u-boot that came with my plug.

What am I doing wrong?

Thanks for any help with this.
Logged

Sethlans
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #11 on: May 23, 2009, 09:39:25 PM »

I can't get this to work.  I've got everything copied to my SD card...

You don't have a proper partition table, create a partition first.

fdisk /dev/mmcblk0
press "o"  / create a new partition table
press "n"  / create a new partition
press "a"  / set the boot flag
press "w" / save changes

Then follow the steps already mentioned using the new partition (possibly mmcblk0p1)
Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #12 on: May 23, 2009, 10:13:42 PM »

I think the problem is that you are overwriting the wrong boot args, please do the
setenv bootargs root=/dev/mmcblk0

and then do a printenv, it should be like this:

bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mmcblk0 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none

if not, then you are not using the correct bootargs
Logged

loonsailor
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #13 on: May 24, 2009, 02:37:13 PM »

Thanks for the help, sethlans & karurosu.  Those two suggestions made it work.

The environment in u-boot was a little weird.  When I reset and do a printenv inside u-boot, I get both:

bootargs_root=root=/dev/mtdblock2 ro
...and...
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none

If I type "printenv bootargs", I just get the second, longer line.  Note that it includes the "root=...".  I found that I needed to re-enter that whole line, but with "mmcblk0p1" substituted for "mtdblock1".

I'm pretty sure I'm now running off the sd card, because "df" yields:

Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                 7707056    516540   6799016   8% /
tmpfs                   257816         0    257816   0% /lib/init/rw
varrun                  257816       232    257584   1% /var/run
varlock                 257816         0    257816   0% /var/lock
udev                    257816        12    257804   1% /dev
tmpfs                   257816         0    257816   0% /dev/shm
tmpfs                   257816         0    257816   0% /var/cache/apt

Since, rootfs is much bigger, it must be the sd card.  Also, during boot, I get the messages "EXT3 FS on mmcblk0p1, internal journal", "EXT3-fs: mounted filesystem with ordered data mode.", "VFS: Mounted root (ext3 filesystem)."  I'm not sure how else to tell, since "mount" just tells me "rootfs on / type rootfs (rw)", rather than telling me the actual device.

Two weird things that I'd still like help with.

  • I tried to mount the built-in nand flash with the command "mount -r /dev/mtdblock1 /nandflash", but it gives me the error message "FAT: bogus number of reserved sectors", and crashes the system.  No further response until I physically reset.  Should it be possible to mount the internal flash, while running with the sd card as root?

  • The file system seems MUCH bigger on the sd card than it was in the internal flash even though, I think, it is identical.  As you can see above, df tells me that 516MB is used on the root file system.  When running off the internal flash, df told me that ~185MB was used. I imaging that some of the difference is the journaling (the SD is formatted with ext3).  Is there some other reason that the same data is using 2.5X the space?

Thanks again for all the help, past and future.

Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #14 on: May 24, 2009, 03:03:02 PM »

To check if you are using the SD, simply do a
cat /etc/mtab

if you see something like:

/dev/mmcblk0p1 / ext3 rw,noatime 0 0

that means you re using the SD.

to mount it you have to use:

mount /dev/mtdblock1 /mnt/nand -t jffs2

Its a good practice to mount always inside /mnt, unless needed (like mounting on /var or /usr)
Ext3 reserves around 5-10% of the total space for its own use, so its normal that you have less space available. It has nothing to do with the files.
Logged

Pages: [1] 2 3
Print
Jump to: