public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user]  CF and Gentoo
@ 2008-09-25 19:18 James
  2008-09-25 21:38 ` Neil Bothwick
  2008-09-28 16:05 ` [gentoo-user] " Simon
  0 siblings, 2 replies; 9+ messages in thread
From: James @ 2008-09-25 19:18 UTC (permalink / raw
  To: gentoo-user

Hello,

Background:
I've been on a journey to migrate many servers (firewalls and dns)
to Compact Flash (CF) drives to improve reliability, ease in new
installation, ease replacing hard drivers that fail, duplicating 
drives that fail and cloning servers with a simple, straightforward 
methodology.

This is the CF method, later on I'll do a USB page, but, lots
of older hardware will not boot off of usb, but if somebody wants
to write to me a methodology for usb sticks, that would be cool.

I'm not exactly the quintessential sys-admin, so as I outline
my ideas and issues, please feel encouraged to help me make the
efforts better. Hopefully, it will result in a wiki that everyone
can use.


Issue 1. Cost containment.
Right now, I'm using 4GB Sandisk CF cards in vintage x86 and k5
machines without issue. I use CF-2-ide converters that are not
labels, made in china. It'd be nice to be able to use some of
the less expensive 4GB CF cards, but I have not tested any, and
do not wish to purchase a random sample to establish confidence.
Any one with low-cost CF cards that work reasonable well, just let me know.


Issue 2. Ease of access.

Currently, I had a bunch of old IDE chasis that are locked and come in
a tray form. Once you install the tray, you can easily remove the tray
from the front of the machine. The CF-2-ide converters which contain
the CF cards are easily access. I do this because I have many of these
old removable ide trays already. What would be better is to find
pci internal slot cards that have the CF-2-ide built in and the
CF cards would be accessible from the back of the machines. Any
suggests for this type of hardware would been keen.

Issue 3. Ease of purchase.
I'd really like to find a single, low-cost supplier of the CF
cards and the CF-2-ide converter hardware. Any suggestions?


Issue 4. Cloning or Duplicating.
As many of you know, installations can be quite time consuming,
and challenging on old PCs. So what I intend to do is take
and currently running machine and stream the contents to
another machine with a CF burner or pull the CF card from
a machine that is in good shape but shutdown and duplicate it.

Two issues I see.

4A. Best method to duplicate the CF card live while the system
is running.

DD, cpio, scp (example syntax) in a step by step)?

4B. What is the minimal amount of data/files that need to be edited
bot build a similar but unique machine.
 1. IP address (edit conf.d/net).
 2. Name (edit) conf.d/hostname).
Anything else?


James





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user]  CF and Gentoo
  2008-09-25 19:18 [gentoo-user] CF and Gentoo James
@ 2008-09-25 21:38 ` Neil Bothwick
  2008-09-26 18:21   ` [gentoo-user] " James
  2008-09-28 16:05 ` [gentoo-user] " Simon
  1 sibling, 1 reply; 9+ messages in thread
From: Neil Bothwick @ 2008-09-25 21:38 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On Thu, 25 Sep 2008 19:18:56 +0000 (UTC), James wrote:

> I've been on a journey to migrate many servers (firewalls and dns)
> to Compact Flash (CF) drives to improve reliability,

Bear in mind the limited write lifetime of flash memory. Don't put /var
or /tmp on such a card if you can avoid it.

http://linitx.com/viewproduct.php?prodid=10448

> Issue 4. Cloning or Duplicating.
> As many of you know, installations can be quite time consuming,
> and challenging on old PCs. So what I intend to do is take
> and currently running machine and stream the contents to
> another machine with a CF burner or pull the CF card from
> a machine that is in good shape but shutdown and duplicate it.

Why not copy the contents of a card to a hard disk somewhere? That way
you don't have to disturb a running machine to make a copy.

> 4A. Best method to duplicate the CF card live while the system
> is running.

Don't.

> DD, cpio, scp (example syntax) in a step by step)?

You could dd the card to a file and use the same file every time you need
a new card.

> 4B. What is the minimal amount of data/files that need to be edited
> bot build a similar but unique machine.
>  1. IP address (edit conf.d/net).
>  2. Name (edit) conf.d/hostname).

Both of these can be handled by DHCP.


-- 
Neil Bothwick

File not found. Should I fake it? (Y/N)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-user]  Re: CF and Gentoo
  2008-09-25 21:38 ` Neil Bothwick
@ 2008-09-26 18:21   ` James
  2008-09-26 22:05     ` Neil Bothwick
  2008-09-27 22:18     ` Stroller
  0 siblings, 2 replies; 9+ messages in thread
From: James @ 2008-09-26 18:21 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick <neil <at> digimed.co.uk> writes:


> Bear in mind the limited write lifetime of flash memory. Don't put /var
> or /tmp on such a card if you can avoid it.

Well, I'm not sure any other alternatives are attractive? Unless
I find a way to mount those partitions off of a usb stick, or
some other idea?

Since they are not frequently updated and have minimal installed software
(iptables on firewalls and DNS on DNS servers) accompanied by the
fact that most devices have internal wear leveling; it should take
many years to reach the write cycle limits?


> http://linitx.com/viewproduct.php?prodid=10448

very cool! exactly what I could not find.



> > Issue 4. Cloning or Duplicating.
> > As many of you know, installations can be quite time consuming,
> > and challenging on old PCs. So what I intend to do is take
> > and currently running machine and stream the contents to
> > another machine with a CF burner or pull the CF card from
> > a machine that is in good shape but shutdown and duplicate it.
 
> Why not copy the contents of a card to a hard disk somewhere? That way
> you don't have to disturb a running machine to make a copy.

> > DD, cpio, scp (example syntax) in a step by step)?

> You could dd the card to a file and use the same file every time you need
> a new card.

Um I do not mean to be a pain, but could you provide a little bit
of pseudo-syntax? Assume I have shutdown a 4 GB CF firewall card
and moved it to a reader/writer on another machine. First I need
to format the raw (new) 4GB CF card from a reader.

/media/sdb1 shows up, but when I run 'fdisk /media/sdb1' I get:

last_lba(): I don't know how to handle files with mode 40755
You will not be able to write the partition table.


In the past I have formated the CF cards on the new machine being built,
but I need help figuring out how to do this, from a CF reader/writer
on another machine (thus avoiding a traditional install) ?


James






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user]  Re: CF and Gentoo
  2008-09-26 18:21   ` [gentoo-user] " James
@ 2008-09-26 22:05     ` Neil Bothwick
  2008-09-27 22:18     ` Stroller
  1 sibling, 0 replies; 9+ messages in thread
From: Neil Bothwick @ 2008-09-26 22:05 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2403 bytes --]

On Fri, 26 Sep 2008 18:21:06 +0000 (UTC), James wrote:

> > Bear in mind the limited write lifetime of flash memory. Don't
> > put /var or /tmp on such a card if you can avoid it.
> 
> Well, I'm not sure any other alternatives are attractive? Unless
> I find a way to mount those partitions off of a usb stick, or
> some other idea?
> 
> Since they are not frequently updated and have minimal installed
> software (iptables on firewalls and DNS on DNS servers) accompanied by
> the fact that most devices have internal wear leveling; it should take
> many years to reach the write cycle limits?

What about /var/log? The various logfiles are written very frequently.
Could you NFS mount this from somewhere else? I wouldn't rely on wear
levelling in a CF card, only on an SSDdrive.

> > http://linitx.com/viewproduct.php?prodid=10448
> 
> very cool! exactly what I could not find.

I used one of their adaptors to run a MythTV frontend from CF, although
it netboots now. I used a variation on a live CD setup, so the card was
not written to.

> > You could dd the card to a file and use the same file every time you
> > need a new card.
> 
> Um I do not mean to be a pain, but could you provide a little bit
> of pseudo-syntax? Assume I have shutdown a 4 GB CF firewall card
> and moved it to a reader/writer on another machine. First I need
> to format the raw (new) 4GB CF card from a reader.
> 
> /media/sdb1 shows up, but when I run 'fdisk /media/sdb1' I get:
> 
> last_lba(): I don't know how to handle files with mode 40755
> You will not be able to write the partition table.

/media/sdb1 is the mount point, not the device node. Use

dd if=/dev/sdb of=CF.img bs=4096

to read the card, switch of and if to write a new one. Of course, all the
cards have to be the same size.

> In the past I have formated the CF cards on the new machine being built,
> but I need help figuring out how to do this, from a CF reader/writer
> on another machine (thus avoiding a traditional install) ?

You don't need to format at all if you dd the whole drive, as that
includes the partition table, MBR and the kitchen sink.


-- 
Neil Bothwick

Rude alert, rude alert! A fire has knocked out my voice recognition
unicycle. Many wurlitzers are missing from my database. Abandon shop,
abandon shop! This is not a daffodil, repeat, this is not a daffodil!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user]  Re: CF and Gentoo
  2008-09-26 18:21   ` [gentoo-user] " James
  2008-09-26 22:05     ` Neil Bothwick
@ 2008-09-27 22:18     ` Stroller
  2008-09-28  6:55       ` Alan McKinnon
  1 sibling, 1 reply; 9+ messages in thread
From: Stroller @ 2008-09-27 22:18 UTC (permalink / raw
  To: gentoo-user


On 26 Sep 2008, at 19:21, James wrote:

> Neil Bothwick <neil <at> digimed.co.uk> writes:
>
>
>> Bear in mind the limited write lifetime of flash memory. Don't put / 
>> var
>> or /tmp on such a card if you can avoid it.
>
> Well, I'm not sure any other alternatives are attractive? Unless
> I find a way to mount those partitions off of a usb stick, or
> some other idea?
>
> Since they are not frequently updated and have minimal installed  
> software
> (iptables on firewalls and DNS on DNS servers) accompanied by the
> fact that most devices have internal wear leveling; it should take
> many years to reach the write cycle limits?

I've read a fair little bit about this subject and never gotten a  
definitive answer on what is "safe", but AIUI the wear-levelling on  
flash memory is filesystem-dependent. Thus it may work fabulously well  
for FAT filesystems, and not at all for EXT.

Having said that, from my experience most of the nay-sayers telling  
you not to put stuff on a CFcard for this reason are talking  
speculatively - I have encountered one or two people who have used  
CFcards very happily for years. It does seem sensible to store logs,  
tmp & Portage directories on a RAM disk or hard-drive, NFS mounted if  
necessary, but generally I would say just get on & try it. 4gig  
CFcards are, after all, cheap as chips these days. Oh! It may be  
possible to reduce the number of writes to the card by changing mount  
options in /etc/fstab and have writes flushed less frequently.

You might consider posting about this - or merely searching the  
archives - on the MythTV users list, as the subject does come up  
periodically and there are a number of people using CF cards in this  
way to reduce noise in the TV room.

>> You could dd the card to a file and use the same file every time  
>> you need
>> a new card.
>
> Um I do not mean to be a pain, but could you provide a little bit
> of pseudo-syntax? Assume I have shutdown a 4 GB CF firewall card
> and moved it to a reader/writer on another machine. First I need
> to format the raw (new) 4GB CF card from a reader.


Put CFcard with existing filesystem in card-reader:
   dd if=/dev/sdX of=~/diskimage.img

Swap cards in reader, writing to blank now:
   dd if=~/diskimage.img of=/dev/sdX

You need to ensure that neither card is mounted when following this  
procedure - booting from a LiveCD or 3rd filesystem.

Stroller.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user]  Re: CF and Gentoo
  2008-09-27 22:18     ` Stroller
@ 2008-09-28  6:55       ` Alan McKinnon
  0 siblings, 0 replies; 9+ messages in thread
From: Alan McKinnon @ 2008-09-28  6:55 UTC (permalink / raw
  To: gentoo-user

On Sunday 28 September 2008 00:18:35 Stroller wrote:
> > Since they are not frequently updated and have minimal installed  
> > software
> > (iptables on firewalls and DNS on DNS servers) accompanied by the
> > fact that most devices have internal wear leveling; it should take
> > many years to reach the write cycle limits?
>
> I've read a fair little bit about this subject and never gotten a  
> definitive answer on what is "safe", but AIUI the wear-levelling on  
> flash memory is filesystem-dependent. Thus it may work fabulously well  
> for FAT filesystems, and not at all for EXT.

Rule of thumb:

The problem is that the ability for individual memory cells to reliably 
perform writes deteriorates over time. Cheap and nasty devices can start to 
fail after 10,000 writes to a cell, the better devices can often cope with 
100,000 writes to a single cell.

The reason there is little definitive data is that it isn't a definitive 
problem - the variables vary wildly. Like you say, some filesystems do wear 
levelling (some better than others), some use cases are frugal with their 
writes, and the device itself has enormous variance as to when it will stop 
performing as expected.

The numbers above must be interpreted as the maximum number of writes where 
the manufacturer is still prepared to guarantee the device. 

-- 
alan dot mckinnon at gmail dot com



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user]  CF and Gentoo
  2008-09-25 19:18 [gentoo-user] CF and Gentoo James
  2008-09-25 21:38 ` Neil Bothwick
@ 2008-09-28 16:05 ` Simon
  2008-10-03  1:52   ` [gentoo-user] " James
  1 sibling, 1 reply; 9+ messages in thread
From: Simon @ 2008-09-28 16:05 UTC (permalink / raw
  To: gentoo-user

> 4A. Best method to duplicate the CF card live while the system
> is running.

Best method I now which is near effort-less, but requires preparation is to 
setup your drive initially as a RAID-1 mirror but force it to have only one 
drive (if you don't want it mirrored all the time).

Then, add a new drive to the RAID-1 and watch the synchronization.  Once 
finished, take the drive out by failing it cleanly then by removing it, and you 
have an integral raid-mirrored copy of your original drive while it was running.

On my own home-gateway, I used this to "burn" the latest state of the system to 
disk, and I used usb keys as main drives.  At boot, it would pick up which ever 
is in most current state and update the other.  And later in my local script, I 
would fail the hard drive so this gateway would become completely silent, except 
for the fan. (Noise was a big factor in my setup as it uses real old hardware)

You could do exactly the same using a device in ram to avoid witting to the 
compact flash.  It would boot from the single-mirror on your drive, sync with a 
device-in-ram (see ramfs and losetup, quite a hack but always worked for me), 
then fail the physical drive and run only on ram.  Then in your local.stop 
script re-sync with the physical drive.

The biggest problem with this method and flash cards is with the write limit. 
The RAID sync will overwrite every single byte on the card, so every physical 
sector will decrease in lifespan.  Where is you used an intelligent copy program 
such as rsync, sector lifespan would increase more randomly and more slowly.

I do not recommend the use of flash cards for anything else than read-only data 
(that you can change sometimes).  I compare it to a better-cd-rw.

Simon



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-user]  Re: CF and Gentoo
  2008-09-28 16:05 ` [gentoo-user] " Simon
@ 2008-10-03  1:52   ` James
  2008-10-03  7:23     ` Mick
  0 siblings, 1 reply; 9+ messages in thread
From: James @ 2008-10-03  1:52 UTC (permalink / raw
  To: gentoo-user

Simon <turner25 <at> gmail.com> writes:


> Best method I now which is near effort-less, but requires preparation is to 
> setup your drive initially as a RAID-1 mirror but force it to have only one 
> drive (if you don't want it mirrored all the time).
> 


Thanks for all of the input. I have a severe knee injury, (basketball)
 so this project will be put on ice, until after knee surgery.


thanks to all that helped.


James









^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user]  Re: CF and Gentoo
  2008-10-03  1:52   ` [gentoo-user] " James
@ 2008-10-03  7:23     ` Mick
  0 siblings, 0 replies; 9+ messages in thread
From: Mick @ 2008-10-03  7:23 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

On Friday 03 October 2008, James wrote:
> Simon <turner25 <at> gmail.com> writes:
> > Best method I now which is near effort-less, but requires preparation is
> > to setup your drive initially as a RAID-1 mirror but force it to have
> > only one drive (if you don't want it mirrored all the time).
>
> Thanks for all of the input. I have a severe knee injury, (basketball)
>  so this project will be put on ice, until after knee surgery.
>
>
> thanks to all that helped.

Good luck James and best wishes for a quick recovery!
-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-10-03 18:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-25 19:18 [gentoo-user] CF and Gentoo James
2008-09-25 21:38 ` Neil Bothwick
2008-09-26 18:21   ` [gentoo-user] " James
2008-09-26 22:05     ` Neil Bothwick
2008-09-27 22:18     ` Stroller
2008-09-28  6:55       ` Alan McKinnon
2008-09-28 16:05 ` [gentoo-user] " Simon
2008-10-03  1:52   ` [gentoo-user] " James
2008-10-03  7:23     ` Mick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox