[ previous ] [ next ] [ threads ]
 
 From:  krt <kkrrtt at gmail dot com>
 To:  Jonathan De Graeve <Jonathan dot DeGraeve at imelda dot be>
 Cc:  George Farris <farrisg at mala dot bc dot ca>, m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] Any way to expand filesystem?
 Date:  Wed, 06 Sep 2006 23:00:30 -0700
My references (where I took the steps from and some of the wording):
http://lists.soekris.com/pipermail/soekris-tech/2003-January/001609.html
http://lists.soekris.com/pipermail/soekris-tech/2003-January/001612.html


The same steps apply for CF as HD when making a new image.

Apply liberal amounts of variance here - the soekris thread covers 
Compact Flash without any real mention of swap.  So do my steps.

I've done this procedure numerous times at this point, mostly to work 
around a few whacky pieces of CF media that I have.  They don't seem to 
like the stock m0n0 1.22 image, so I ended up making "full sized" variants.

With regards to "full sized" - I had bootable success by making slightly 
smaller images.  Where the steps in the thread tell you to use the 
number of sectors/unit, I did (number of sectors/unit) - 1.  If I left 
it as the number reported from disklabel, I was unable to boot my 
written image on my soekris boxes.

The steps are for FreeBSD 4.x - 6.x changes a few of the binaries, like 
  vnconfig... I've been using a FreeBSD 4.11 VMWare image to work with 
these things (and a usb CF reader/writer).

I skipped the rsync bit at the end - I just tar cvpf'd the mounted 
original m0n0 image and tar xvpf'd that tar onto my new image.

So, my steps (rather than get into some squabble over the number of 
steps, I'll say that my steps are done in such a way that each one is an 
entity of itself, such that one might be able to modify this procedure 
for their own purposes without much hassle due to deciphering a non 
familiar shell's syntax)


Assumptions:
I'm in a directory in my home directory called "m0n0wall".
You have the capability of using vnconfig and vn devices
You have made directories to mount images onto - i.e. /mnt1, /mnt2, etc.
This is on FreeBSD 4.11


1) Create a virtual drive as /dev/vn0 by utilizing a m0n0wall image 
file.  In my case, I'm using the net45xx-1.22.img file.  I do this by:

vnconfig -s labels -c vn0 ./net45xx-1.22.img



2) Mount the image.  Note that it's vn0a for the m0n0 instance within 
the vn0 disklabel.

mount /dev/vn0a /mnt1



3) tar up the image:

tar cvpf net45xx-1.22-fs.tar -C /mnt1 .



With the source FS out of the way, it's time to create the new 
filesystem for my destination disk.  In my example, I'm writing to a 
HUGE 64MB CF card.  Yeah, OK, I'm cheap - it's what I have laying around.


4) Delete any partition information on the destination disk.  In my 
case, my usb CF unit shows up as /dev/da0.  Since I'm blowing the whole 
disk away anyways, I sprinkled in more zero's than the soekris posting 
gave as an example:

dd if=/dev/zero of=/dev/da0 bs=1k count=40



5) This is the big step.  You need to figure out how many sectors (and 
therefore, how large) the image will be.

disklabel -rwn da0 auto|grep sectors/unit



6) Create a file that will become your new image, with the correct size.
In my case, my CF media has 125441 (results of step five) sectors, so I 
made this image with one less sector:

dd if=/dev/zero of=./net45xx-1.22-64MB-Sandisk.img bs=512 count=125440



7) Create a virtual drive as /dev/vn1 (or, you could unmount the 
original image and delete the old vn0 device, then create a new vn0 
mapping... either way works - but I found that this lets me dork around 
a little more without having to go through steps 1-3 over again if I 
somehow screwup along the line)

vnconfig -s labels -c vn1 ./net45xx-1.22-64MB-Sandisk.img



8) Throw a disklabel and partitioning onto the image.  Edit the 
disklabel so that the first partition is the whole image size and 
happens to be a 4.2BSD type.

disklabel -Brw vn1 auto
disklabel -e vn1

Find the line that starts with c: and duplicate it, changing the c: to a:
and the fstype to 4.2BSD

e.g.
from:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
   c:   125440        0    unused        0     0         # (Cyl.    0 - 61*)

to:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
   a:   125440        0    4.2BSD        0     0     0   # (Cyl.    0 - 61*)
   c:   125440        0    unused        0     0         # (Cyl.    0 - 61*)



9) Make a new file system on the new images first partition:

newfs -b 8192 -f 1024 -U /dev/vn1a



10) mount the image:

mount /dev/vn1a /mnt2



11) untar the m0n0 1.22 filesystem tar that you made in step 3:

tar xpvf net45xx-1.22-fs.tar -C /mnt2



12) unmount the new image:

unmount /mnt2



13) Write the image out to whatever device you intend to - in my case, 
again, da0:

dd if=net45xx-1.22-64MB-Sandisk.img of=/dev/da0 bs=8k




The proof is in the pudding.  Or in this case, you'll have to take my 
word for it...:
ad0: 61MB <SanDisk SDCFB-64> [490/8/32] at ata0-master BIOSPIO
Mounting root from ufs:/dev/md0c
Found configuration on ad0.
Initializing timezone... done
Initializing PC cards... done
Configuring firewall... done
Configuring LAN interface... done
Configuring WAN interface... done
Starting syslog service... done
Starting webGUI... done
Starting DNS forwarder... done
Starting DHCP service... done
Starting NTP client... done


*** This is m0n0wall, version 1.22
     built on Sun Apr  2 18:57:01 CEST 2006 for net45xx
     Copyright (C) 2002-2006 by Manuel Kasper. All rights reserved.
     Visit http://m0n0.ch/wall for updates.








Jonathan De Graeve wrote:
> I use 16MB default FS size for my own images.
> 
> J.
> 
>> -----Oorspronkelijk bericht-----
>> Van: George Farris [mailto:farrisg at mala dot bc dot ca]
>> Verzonden: woensdag 6 september 2006 22:34
>> Aan: m0n0wall at lists dot m0n0 dot ch
>> Onderwerp: [m0n0wall] Any way to expand filesystem?
>>
>> Is there a way to expand the file system on Monowall?  For instance
>> installing on an HD.
>>
>> --
>> George Farris   farrisg at mala dot bc dot ca
>> Malaspina University-College
>>
>> "Our species' survival depends on how fast we embrace the moral shift
> from
>> 'patriot' to 'global citizen'."
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
>> For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
> For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
> 
>