Discussion:
[9fans] Root file system from usb-hdd on raspberry pi
(too old to reply)
Friedrich Psiorz
2013-03-26 12:51:45 UTC
Permalink
I'm currently trying to set up a usb-hdd as my root filesystem; I found
out, that I have to use partfs to actually see the partitions I create,
however they don't show up after the next reboot; i have to use fdisk's
and prep's w command (without actualy modifying the partition table), to
see the partitions I created in the file system. Is that normal?
Also, I don't yet quite understand how to boot from such a partition.
Somehow I need to get partfs into the kernel; but I don't know how, and
after that, how to use it for booting form the external hdd.

I also tried connecting the hdd to a pc running 9front, and it
flawlessly detected all of the partitions without any intervention. Is
it possible to just use 9front's usb driver or the whole 9front kernel
source and then compile it for the raspberry pi? Would that break any
compatibilities with the labs' plan 9?

For short: what do you think would be the easiest way to get my pi's
root filesystem from my external hdd.

Sorry for so many questions at once, I'm relatively new to plan 9.
erik quanstrom
2013-03-26 13:07:15 UTC
Permalink
Post by Friedrich Psiorz
I'm currently trying to set up a usb-hdd as my root filesystem; I found
out, that I have to use partfs to actually see the partitions I create,
however they don't show up after the next reboot; i have to use fdisk's
and prep's w command (without actualy modifying the partition table), to
see the partitions I created in the file system. Is that normal?
that is normal. but, there is no need to fdisk your disk unless you're
booting from dos. you can use prep directly. for fdisk+prep the
normal way to do this would be
disk/fdisk /dev/sdXX/data>/dev/sdXX/ctl
test -f /dev/sdXX/plan9 && disk/prep /dev/sdXX/plan9>/dev/sdXX/ctl
if you have prep only, only this would be needed
disk/prep /dev/sdXX/plan9>/dev/sdXX/ctl
this is prepackaged in /rc/bin/diskparts, and the kernel will do
this for you on boot.
Post by Friedrich Psiorz
Also, I don't yet quite understand how to boot from such a partition.
Somehow I need to get partfs into the kernel; but I don't know how, and
after that, how to use it for booting form the external hdd.
you need to build partfs into your kernel. add
/arm/bin/disk/partfs
to the bootdir section of your kernel configuration file and rebuild.
in the rpi's case, i believe the kernel config is named /sys/src/9/bcm/pi
or picpu.

- erik
Friedrich Psiorz
2013-03-26 13:47:21 UTC
Permalink
I recompiled the kernel as you said, and noticed that it doesn't
complain about missing partfs during boot anymore; however there is no
additional sd*, still only sdM0 and sdU0.0, which still doesn't show me
any partitions.
Post by erik quanstrom
Post by Friedrich Psiorz
I'm currently trying to set up a usb-hdd as my root filesystem; I found
out, that I have to use partfs to actually see the partitions I create,
however they don't show up after the next reboot; i have to use fdisk's
and prep's w command (without actualy modifying the partition table), to
see the partitions I created in the file system. Is that normal?
that is normal. but, there is no need to fdisk your disk unless you're
booting from dos. you can use prep directly. for fdisk+prep the
normal way to do this would be
disk/fdisk /dev/sdXX/data>/dev/sdXX/ctl
test -f /dev/sdXX/plan9 && disk/prep /dev/sdXX/plan9>/dev/sdXX/ctl
if you have prep only, only this would be needed
disk/prep /dev/sdXX/plan9>/dev/sdXX/ctl
this is prepackaged in /rc/bin/diskparts, and the kernel will do
this for you on boot.
Post by Friedrich Psiorz
Also, I don't yet quite understand how to boot from such a partition.
Somehow I need to get partfs into the kernel; but I don't know how, and
after that, how to use it for booting form the external hdd.
you need to build partfs into your kernel. add
/arm/bin/disk/partfs
to the bootdir section of your kernel configuration file and rebuild.
in the rpi's case, i believe the kernel config is named /sys/src/9/bcm/pi
or picpu.
- erik
erik quanstrom
2013-03-26 13:56:46 UTC
Permalink
Post by Friedrich Psiorz
I recompiled the kernel as you said, and noticed that it doesn't
complain about missing partfs during boot anymore; however there is no
additional sd*, still only sdM0 and sdU0.0, which still doesn't show me
any partitions.
i'm sorry. the distribution assumes you are booting a pc. i think
you can hack around this without changing the source by
putting the partition table information in an environment variable.
the format is
sdB0parts=a 127 128/b 129 130
you'll need to replace a and b and the made up sector numbers with
real values in your configuration.

- erik
Friedrich Psiorz
2013-03-26 14:25:52 UTC
Permalink
Hmm, ok, I'm more confused now than before.
do I have to put all partitions there? Or just the 'plan9' partition
that fdisk created?
Where do I set the environment variable? I tried adding
sdB0parts='p1 0 38913'
to cmdline.txt, but nothing happens.
Post by erik quanstrom
Post by Friedrich Psiorz
I recompiled the kernel as you said, and noticed that it doesn't
complain about missing partfs during boot anymore; however there is no
additional sd*, still only sdM0 and sdU0.0, which still doesn't show me
any partitions.
i'm sorry. the distribution assumes you are booting a pc. i think
you can hack around this without changing the source by
putting the partition table information in an environment variable.
the format is
sdB0parts=a 127 128/b 129 130
you'll need to replace a and b and the made up sector numbers with
real values in your configuration.
- erik
erik quanstrom
2013-03-26 14:35:45 UTC
Permalink
Post by Friedrich Psiorz
Hmm, ok, I'm more confused now than before.
sorry. evidently i'm not good at explaining this.
Post by Friedrich Psiorz
do I have to put all partitions there? Or just the 'plan9' partition
that fdisk created?
put all the partitions in. (but remember, there is no reason to use fdisk
partitions at all.)
Post by Friedrich Psiorz
Where do I set the environment variable? I tried adding
sdB0parts='p1 0 38913'
to cmdline.txt, but nothing happens.
i misspelled it. it should be "sdB0part". no "s". my bad.

- erik
Friedrich Psiorz
2013-03-26 15:53:59 UTC
Permalink
No I get these errors when booting:

can't update /dev/sdXX/data's devsd partition table for nvram: partition
name already in use: "part nvram 63 64"
can't update /dev/sdXX/data's devsd partition table for fossil:
partition name already in use: "part fossil 64 99518702"
can't update /dev/sdXX/data's devsd partition table for arenas:
partition name already in use: "part arenas 99518702 597111894"
can't update /dev/sdXX/data's devsd partition table for isect: partition
name already in use: "part isect 597111894 621991554"
can't update /dev/sdXX/data's devsd partition table for swap: partition
name already in use: "part swap 621991554 623040130"
can't update /dev/sdXX/data's devsd partition table for cache: partition
name already in use: "part cache 623040130 625137282"

the numbers are what's in the partition table +63
they are the same, no matter if I set sdB0part to these numbers or the
ones from the partition table
Post by erik quanstrom
Post by Friedrich Psiorz
Hmm, ok, I'm more confused now than before.
sorry. evidently i'm not good at explaining this.
Post by Friedrich Psiorz
do I have to put all partitions there? Or just the 'plan9' partition
that fdisk created?
put all the partitions in. (but remember, there is no reason to use fdisk
partitions at all.)
Post by Friedrich Psiorz
Where do I set the environment variable? I tried adding
sdB0parts='p1 0 38913'
to cmdline.txt, but nothing happens.
i misspelled it. it should be "sdB0part". no "s". my bad.
- erik
Friedrich Psiorz
2013-03-26 22:53:19 UTC
Permalink
Also, the disk still doesn't show up as sdB0 or sdXX or something like
that in /dev; still only sdU0.0
Do I have to do something to make sdB0/sdXX appear?
Post by Friedrich Psiorz
can't update /dev/sdXX/data's devsd partition table for nvram: partition
name already in use: "part nvram 63 64"
partition name already in use: "part fossil 64 99518702"
partition name already in use: "part arenas 99518702 597111894"
can't update /dev/sdXX/data's devsd partition table for isect: partition
name already in use: "part isect 597111894 621991554"
can't update /dev/sdXX/data's devsd partition table for swap: partition
name already in use: "part swap 621991554 623040130"
can't update /dev/sdXX/data's devsd partition table for cache: partition
name already in use: "part cache 623040130 625137282"
the numbers are what's in the partition table +63
they are the same, no matter if I set sdB0part to these numbers or the
ones from the partition table
Post by erik quanstrom
Post by Friedrich Psiorz
Hmm, ok, I'm more confused now than before.
sorry. evidently i'm not good at explaining this.
Post by Friedrich Psiorz
do I have to put all partitions there? Or just the 'plan9' partition
that fdisk created?
put all the partitions in. (but remember, there is no reason to use fdisk
partitions at all.)
Post by Friedrich Psiorz
Where do I set the environment variable? I tried adding
sdB0parts='p1 0 38913'
to cmdline.txt, but nothing happens.
i misspelled it. it should be "sdB0part". no "s". my bad.
- erik
David du Colombier
2013-03-27 07:59:16 UTC
Permalink
Post by Friedrich Psiorz
Also, the disk still doesn't show up as sdB0 or sdXX or something like
that in /dev; still only sdU0.0
Do I have to do something to make sdB0/sdXX appear?
disk/partfs /dev/sdU0.0/data
Friedrich Psiorz
2013-03-27 09:18:15 UTC
Permalink
I think that's already partly being done, I found /srv/partfs.sdXX, I
just need to mount that. Can I do something in the kernel command line
to mount it automatically, so I can get my root fileystem from there?
Sorry, I'm still very confused by the whole boot process.
Post by David du Colombier
Post by Friedrich Psiorz
Also, the disk still doesn't show up as sdB0 or sdXX or something like
that in /dev; still only sdU0.0
Do I have to do something to make sdB0/sdXX appear?
disk/partfs /dev/sdU0.0/data
Richard Miller
2013-03-27 14:43:04 UTC
Permalink
Post by Friedrich Psiorz
Can I do something in the kernel command line
to mount it automatically, so I can get my root fileystem from there?
If the command line contains 'readparts= bootargs=local!/dev/sdXX/fossil'
and the kernel is built with partfs and fossil in the bootdir section,
this should work automatically (with no need for sdB0part=).

However I've just tried this and it doesn't work for me either. I will
investigate further...
Richard Miller
2013-03-27 17:37:03 UTC
Permalink
Post by Richard Miller
I will
investigate further...
It turns out that usb boot is more complicated than it needs to be. With
readparts= the partitions are set up automatically, but then they are thrown
away again, I think because partfs is being started more than once. I will
leave it to the original authors to look at, but a workaround is to use sdB0part
as Erik suggested. I find this cmdline.txt works for me:

sdB0part='fossil 204864 1804192' bootargs=local!/dev/sdXX/fossil ipconfig=

where the sdB0part numbers are found from 'grep fossil /dev/sdXX/ctl'
Continue reading on narkive:
Search results for '[9fans] Root file system from usb-hdd on raspberry pi' (Questions and Answers)
6
replies
Will linux work well on my computer?
started 2014-04-09 17:44:31 UTC
computer networking
Loading...