I have recently gotten back to making Voyage USB drive systems. We use these for network testing, most often iperf with tcpdump and analysis. It is very useful to have a modifiable system so I am not using squeezefs, but I would also like to make the images as small as possible for transfer over WAN links.<br>
<br>So, I have a 1 GB USB drive as the master, and a compressed image was 600 MB. This week I reduced that to 200 MB by making a large zero filled file in all of the empty disk space and then deleting it before doing the dd image copy and gzipping. 700 MB of zeros compresses a lot better than random bits!<br>
<br>Tonight I successfully used gpartd to expand the file system after the 1 GB image was copied to a 4 GB USB flash drive.<br><br>Jon<br><br><br><div class="gmail_quote">2011/10/12 <span dir="ltr"><<a href="mailto:jfh@greenhousepc.com">jfh@greenhousepc.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><span style="font-family: Verdana; color: rgb(0, 0, 0); font-size: 10pt;"><div>Greets,<br>
</div><div><br></div><div>Thanks for sharing this -- any tips that can help people deploy Voyage are helpful.</div><div><br></div><div>I use a similar process to what you described -- I keep an old MBR lying around (heh) with a partition table that I just so happen to like. When I create the first partition, I create the partition with the target size, then the rest of the partitions (I have a VERY small swap whose sole purpose is to prevent crashes -- the total swap traffic is non-existent, and when the systems swap, I find out why and fix that). THEN I go back and delete the root partition and make it a small size -- I'm up to 640MB right now. I then DD in the root image I have, all 620 or 630MB of data.</div>
<div><br></div><div>Once the root partition has been imaged this way, I go back, delete the first partition a second time, then expand it to fit all the space it fit before. Why do it this way? Because this way I know when the image file is too large -- it's a check for the DD that I use to image that partition. Also, if I need to capture the partition image, the partition is still only 640MB and I'm not stuck playing games to trim it down.</div>
<div><br></div><div>With the root partition back to the size I want, I can now expand the filesystem to fit all available space.<br></div><div>--<br>Julie Haugh<br>Senior Design Engineer<br>greenHouse Computers, LLC // jfh at <a href="http://greenhousepc.com" target="_blank">greenhousepc.com</a> // greenHousePC on Skype</div>
<div><br><br></div>
<blockquote style="border-left: 2px solid blue; margin-left: 8px; padding-left: 8px; font-size: 10pt; color: black; font-family: verdana;">
<div>
-------- Original Message --------<br>
Subject: [Voyage-linux] Re: Question about copying Voyage installation<br>
on CFs<br>
From: Gustin Johnson <<a href="mailto:gustin@meganerd.ca" target="_blank">gustin@meganerd.ca</a>><br>
Date: Wed, October 12, 2011 4:19 pm<br>
To: Emilio Arrufat <<a href="mailto:emilio@lagalera.org" target="_blank">emilio@lagalera.org</a>><br>
Cc: voyage linux Mailing List <<a href="mailto:Voyage-linux@voyage.hk" target="_blank">Voyage-linux@voyage.hk</a>><div><div></div><div class="h5"><br>
<br>
Also CC'ing the list as this may be useful to some.<br>
<br>
The procedure that you listed should have worked if you had<br>
partitioned the new CF card first.<br>
<br>
The first 512 bytes of a disk contain the MBR (Master Boot Record) and<br>
partition table. The first 446 bytes contain the MBR while the rest<br>
is the partition table.<br>
<br>
If you want the process to be repeatable what I would suggest is to<br>
make your primary partition significantly less (say 50 megabytes or so<br>
to be safe) than the smallest card you are likely to use. Around here<br>
I cannot buy anything smaller than a 4 GB CF card so I make my system<br>
images ~3.9 GB.<br>
<br>
At this point there are a couple of slightly different ways to go.<br>
<br>
First, you could backup the original card as you described below.<br>
Then you partition the new card with fdisk/cfdisk/parted etc. You<br>
then restore the MBR to the major device name (eg. /dev/sdc) inverting<br>
the command you used to backup the MBR. You then restore the<br>
partition back to the minor device name (eg. /dev/sdc1). At this<br>
point you should be good to go.<br>
<br>
The second choice is to simply ddrescue one card over to the other.<br>
If the destination is slightly smaller you may have to repair the<br>
partition table but you should still be able to boot off the imaged<br>
device.<br>
<br>
If you do this often enough, something like FOG might be useful to<br>
image these systems with. We used to do this but we now deploy so few<br>
that we just build again from scratch using the latest version of<br>
voyage. We do very little customization as we use the Alix SBCs as<br>
network appliances, so things like the firewall, traffic shaping, and<br>
multipath routing take minutes to install (just bash scripts that we<br>
put in /usr/local/ with symlinks to /etc/init.d) and usually<br>
everything else we need is already on the system.<br>
<br>
Hope this helps!<br>
<br>
On Tue, Oct 11, 2011 at 4:33 PM, Emilio Arrufat <<a href="mailto:emilio@lagalera.org" target="_blank">emilio@lagalera.org</a>> wrote:<br>
> Dear Gustin,<br>
> my name is Emilio Arrufat, from Spain. I would apologize for any<br>
> inconvenience for sending to you this message, but I would want to ask<br>
> you about a procedure you wrote I have found on internet about<br>
> duplicating Voyage in CF cards of different sizes.<br>
><br>
> It solves many problems I was wondering about, in particular when I<br>
> tried to duplicate a whole, say 1GB, card to another 1GB one I found<br>
> what you mentioned: "If you want to backup the whole drive and you are<br>
> sure that the drives are exactly the same (even though they are both 8<br>
> GB, they may not be exactly the same, down to the last byte), I<br>
> usually just use ddrescue." My cards had different geometry and<br>
> duplication did not work. So when I read from you "What I do is backup<br>
> the MBR and partitions separately. " it sounded to me as my solution.<br>
><br>
> However I have tried several times with no luck. Let me tell what I<br>
> did and ask you if you can give me any advice:<br>
><br>
> say my CF is /dev/sdc. First of all I formatted the first card with a<br>
> size slightly minor than 1GB, not ocuppying the whole card, to avoid<br>
> restoring on cards with a few less capacity. Installed Voyage and test<br>
> it.<br>
><br>
> Second I follow your procedure: 1) backed up the card MBR: dd<br>
> if=/dev/sdc of=/path/to/alix.MBR.img count=1 bs=446 and 2) backed up<br>
> the partition where Voyage is installed: ddrescue /dev/sdc1<br>
> /path/to/alix.sda1.img<br>
><br>
> Third: I partitioned the second card with a partition expanding to the<br>
> whole capacity (hope bigger size than first card) and restored the<br>
> MBR: dd if=/path/to/alix.MBR.img of=/dev/sdc count=1 bs=446 and the<br>
> partition of Voyage: ddrescue /path/to/alix.sda1.img /dev/sdc1<br>
><br>
> The restoring ended with no errors, but the OS does not boot up. I<br>
> have tested it several times.<br>
><br>
> Do you have any clue?<br>
><br>
> I would appreciate your help,<br>
><br>
> thanks in advance,<br>
><br>
> Emilio Arrufat<br>
><br>
<br>
_______________________________________________<br>
Voyage-linux mailing list<br>
<a href="mailto:Voyage-linux@list.voyage.hk" target="_blank">Voyage-linux@list.voyage.hk</a><br>
<a href="http://list.voyage.hk/mailman/listinfo/voyage-linux" target="_blank">http://list.voyage.hk/mailman/listinfo/voyage-linux</a><br>
</div></div></div>
</blockquote></span></div>
<br>_______________________________________________<br>
Voyage-linux mailing list<br>
<a href="mailto:Voyage-linux@list.voyage.hk">Voyage-linux@list.voyage.hk</a><br>
<a href="http://list.voyage.hk/mailman/listinfo/voyage-linux" target="_blank">http://list.voyage.hk/mailman/listinfo/voyage-linux</a><br>
<br></blockquote></div><br>