Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bootable flash with part of it read-write?

0 views
Skip to first unread message

plen...@yahoo.com

unread,
Dec 23, 2007, 8:04:43 PM12/23/07
to
Hi all,

I've got a CompactFlash card that I'm booting off of,
and which has an initrd.img on it that should provide
some basic commands. But what I really want is
to have a normal r/w filesystem, as if the bootable
flash were a hard drive. (I know now I can get a
2.5" IDE -> CF adapter, but don't have one yet.)

My question is, how can I make the bootable flash
something that can also hold a read-write /home tree?

Presently when I try to fdisk the bootable flash
I get a bunch of errors, so it's not like I can create
a 2nd partition on it.

When I mount the flash, I have found that this works:
mount -o loop -t auto /dev/sda /flash
Typing mount again tells me that the filesystem type
is vfat.

Thanks for any help.

Bill Marcum

unread,
Dec 23, 2007, 9:44:30 PM12/23/07
to
On 2007-12-24, plen...@yahoo.com <plen...@yahoo.com> wrote:
>
>
> Hi all,
>
> I've got a CompactFlash card that I'm booting off of,
> and which has an initrd.img on it that should provide
> some basic commands. But what I really want is
> to have a normal r/w filesystem, as if the bootable
> flash were a hard drive. (I know now I can get a
> 2.5" IDE -> CF adapter, but don't have one yet.)
>
> My question is, how can I make the bootable flash
> something that can also hold a read-write /home tree?
>
> Presently when I try to fdisk the bootable flash
> I get a bunch of errors, so it's not like I can create
> a 2nd partition on it.
>
What errors do you get? Maybe it would work if you zeroed out the first
sector of the device with
dd if=/dev/zero of=/dev/sda bs=512 count=1

> When I mount the flash, I have found that this works:
> mount -o loop -t auto /dev/sda /flash
> Typing mount again tells me that the filesystem type
> is vfat.
>

Does it work if you mount the flash without -o loop?

> Thanks for any help.
>

Gernot Fink

unread,
Dec 24, 2007, 5:13:01 AM12/24/07
to
In article <4f5f88eb-a769-4ae1...@e4g2000hsg.googlegroups.com>,
plen...@yahoo.com writes:
> Hi all,

> When I mount the flash, I have found that this works:
> mount -o loop -t auto /dev/sda /flash
> Typing mount again tells me that the filesystem type
> is vfat.

Why do you use the loop option. sda is a real device.
You can mount /dev/sda read/write and use the fat filesystem.

Now its possible to make a big file on this device which you can use as
ext2 loop filesystem for /home.

--
MFG Gernot

Douglas Mayne

unread,
Dec 26, 2007, 10:55:08 AM12/26/07
to

I assume that you are booting off of a usb port. There are a couple of
steps which are required to use any usb storage device (flash, magnetic,
etc.) as Linux's root filesystem. You mentioned that you are using an
initrd. Your particular initrd should have the kernel modules
which are necessary to add the functionality to begin reading usb
storage devices. On my hardware, I usually make sure that these modules
are loaded (using modprobe): ehci-hcd, uhci-hcd, ohci-hcd, usb-storage.

If your usb controller's chipset requires a different module, then make
sure to include it- the exact module to use is hardware dependant.
Remember to wait a few seconds after inserting the modules while the
bus is scanned and while it stabilizes. Also, if you are using any special
filesystems which require modules, then you should load them, too; for
example, xfs.

You also have various options with respect to your partition layout. IME,
you can treat a flash drive as you would any other disk storage. It can
be partitioned and formatted with the filesystem(s) of your choice. Other
directories (such as /home, /usr) can be mounted into the namespace
according to the plan you have devised using the same techniques as you
would use with a magnetically based disk. I could consider various other
examples, but I will stop right here for now to avoid going too far
afield.


Other Notes...

IME, you should have a partition table which can be reset using fdisk:
# fdisk /dev/sdx

A partitioned device then has partition numbers appended to the name. Here
is the layout on my system:

root@typ12:/# fdisk -l

Disk /dev/hda: 40.8 GB, 40803581952 bytes
16 heads, 63 sectors/track, 79062 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 48442 24414736+ 83 Linux
/dev/hda2 48443 51349 1465128 82 Linux swap
/dev/hda3 51350 79062 13967352 5 Extended
/dev/hda5 51350 79062 13967320+ 83 Linux

IIRC, some bios allow devices to be addressed as "floppy" or "hard disks."
I think it is usually appropriate to set this parameter to treat usb
storage as a hard disk, not a floppy.

Be advised there is a limit for RW cycles for flash memory. Older flash
memory designs had very low limits before failures would occur. Newer
designs may be approaching the MTBF of regular magnetic hard drives now,
but this is something to watch out for.


As far as additional general information, tThis appears to be a popular
link:
http://www.pendrivelinux.com/

I have also written about this before. This response links to other
posts:
http://groups.google.com/group/alt.os.linux.slackware/msg/50b5156cdd7b347a

Even more options are possible. As flash memory increases it will be
possible to keep a complete (non-minimalist) GNU/Linux on a flash drive.
The 2 to 4 gig capacities that available now are already approaching the
space necessary. The falling price levels help, too ;)

Any work you do now to fully understand the boot process is likely to pay
big dividends for you in the future, especially if you would like to
use flash based root filesystems on usb.

--
Douglas Mayne

0 new messages