From sean at b3solutions.co.za Mon Apr 3 16:32:49 2006 From: sean at b3solutions.co.za (Sean Bertinotti) Date: Mon Apr 3 09:34:10 2006 Subject: [Wd_general] Compact Flash damaged after power failure Message-ID: <001101c65723$19ef1a90$0c00a8c0@b3solutions.co.za> Hi All, Thank you for the help previously with auto starting application at boot. I have a new problem :) I am running a small embedded machine with a Compact Flash Card 128MB. My application runs at boot, all good. If the file system encounters errors at startup due to a power failure, it repairs itself and I have added to /etc/rc.d/rc.S "shutdown -r now" to restart the system automatically. The File system is ext2 The problem is sometimes it cannot repair itself and the only way to get past this is to re-install/format the Flash Card. There is no input for when I lose power, so I cannot shutdown the system. How can I unmount the file system or do something that will not cause damage to the file system when there is a power failure. All my application does is receive data through a serial port and display text on the screen. The only other things I use are SSH/Network/SFTP/SCP Please help :) Thanks Sean B -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 2006-03-31 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.emji.net/pipermail/wd_general/attachments/20060403/25f7bd7c/attachment.htm From ccannell at mindspring.com Mon Apr 3 11:03:40 2006 From: ccannell at mindspring.com (Chris J Cannell) Date: Mon Apr 3 10:03:20 2006 Subject: [Wd_general] Compact Flash damaged after power failure In-Reply-To: <001101c65723$19ef1a90$0c00a8c0@b3solutions.co.za> Message-ID: <002701c65727$692ff710$040aa8c0@prescott> Sean, I used to have similar problems with file system errors using ext2 if the system was shutdown improperly. I would suggest moving to a journaled file system like ext3 or reiser. chris _____ From: wd_general-bounces@lists.emji.net [mailto:wd_general-bounces@lists.emji.net] On Behalf Of Sean Bertinotti Sent: Monday, April 03, 2006 9:33 AM To: wd_general@lists.emji.net Subject: [Wd_general] Compact Flash damaged after power failure Hi All, Thank you for the help previously with auto starting application at boot. I have a new problem :) I am running a small embedded machine with a Compact Flash Card 128MB. My application runs at boot, all good. If the file system encounters errors at startup due to a power failure, it repairs itself and I have added to /etc/rc.d/rc.S "shutdown -r now" to restart the system automatically. The File system is ext2 The problem is sometimes it cannot repair itself and the only way to get past this is to re-install/format the Flash Card. There is no input for when I lose power, so I cannot shutdown the system. How can I unmount the file system or do something that will not cause damage to the file system when there is a power failure. All my application does is receive data through a serial port and display text on the screen. The only other things I use are SSH/Network/SFTP/SCP Please help :) Thanks Sean B -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 2006-03-31 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.emji.net/pipermail/wd_general/attachments/20060403/a7537871/attachment.htm From sean at b3solutions.co.za Mon Apr 3 17:38:05 2006 From: sean at b3solutions.co.za (Sean Bertinotti) Date: Mon Apr 3 10:39:41 2006 Subject: [Wd_general] Compact Flash damaged after power failure In-Reply-To: <002701c65727$692ff710$040aa8c0@prescott> Message-ID: <002201c6572c$37acd910$0c00a8c0@b3solutions.co.za> Thank you very much, I will test _____ From: wd_general-bounces@lists.emji.net [mailto:wd_general-bounces@lists.emji.net] On Behalf Of Chris J Cannell Sent: 03 April 2006 16:04 To: 'Sean Bertinotti'; wd_general@lists.emji.net Subject: RE: [Wd_general] Compact Flash damaged after power failure Sean, I used to have similar problems with file system errors using ext2 if the system was shutdown improperly. I would suggest moving to a journaled file system like ext3 or reiser. chris _____ From: wd_general-bounces@lists.emji.net [mailto:wd_general-bounces@lists.emji.net] On Behalf Of Sean Bertinotti Sent: Monday, April 03, 2006 9:33 AM To: wd_general@lists.emji.net Subject: [Wd_general] Compact Flash damaged after power failure Hi All, Thank you for the help previously with auto starting application at boot. I have a new problem :) I am running a small embedded machine with a Compact Flash Card 128MB. My application runs at boot, all good. If the file system encounters errors at startup due to a power failure, it repairs itself and I have added to /etc/rc.d/rc.S "shutdown -r now" to restart the system automatically. The File system is ext2 The problem is sometimes it cannot repair itself and the only way to get past this is to re-install/format the Flash Card. There is no input for when I lose power, so I cannot shutdown the system. How can I unmount the file system or do something that will not cause damage to the file system when there is a power failure. All my application does is receive data through a serial port and display text on the screen. The only other things I use are SSH/Network/SFTP/SCP Please help :) Thanks Sean B -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 2006-03-31 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 2006-03-31 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 2006-03-31 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.emji.net/pipermail/wd_general/attachments/20060403/a6d07804/attachment.htm From gary.james at criticallink.com Mon Apr 3 16:43:28 2006 From: gary.james at criticallink.com (gary.james@criticallink.com) Date: Mon Apr 3 15:43:24 2006 Subject: [Wd_general] Compact Flash damaged after power failure In-Reply-To: <002201c6572c$37acd910$0c00a8c0@b3solutions.co.za> References: <002701c65727$692ff710$040aa8c0@prescott> Message-ID: <443142A0.13136.96DC7B@localhost> > Sean, > I used to have similar problems with file system errors using ext2 if the system was shutdown > improperly. I would suggest moving to a journaled file system like ext3 or reiser. > > chris I am far from an expert, but I thought ext3 was not recommended for falsh based devices because it causes excessive writes to the drive, thus hurting the life span of the drive. Gary James From markphillips at alum.mit.edu Mon Apr 3 17:34:16 2006 From: markphillips at alum.mit.edu (Mark Phillips) Date: Mon Apr 3 16:43:06 2006 Subject: [Wd_general] Compact Flash damaged after power failure In-Reply-To: <443142A0.13136.96DC7B@localhost> References: <002701c65727$692ff710$040aa8c0@prescott> <443142A0.13136.96DC7B@localhost> Message-ID: <443186C8.801@alum.mit.edu> Of course, the best option is to not write to the flash at all, and from your brief description, I see no reason to. Make sure you disable syslogging, and have no swap file; in fact, if your flash device has a write-protect, you can turn that on and see what craps out, and then remove whatever that is. (Others here may be able to give better advice - I'm not that much of an expert)... gary.james@criticallink.com wrote: >>Sean, >> I used to have similar problems with file system errors using ext2 if the system was shutdown >>improperly. I would suggest moving to a journaled file system like ext3 or reiser. >> >>chris > > > I am far from an expert, but I thought ext3 was not recommended for falsh based devices > because it causes excessive writes to the drive, thus hurting the life span of the drive. > > Gary James > > _______________________________________________ > Wd_general mailing list > Wd_general@lists.emji.net > http://lists.emji.net/mailman/listinfo/wd_general > From djohnson at apani.com Mon Apr 3 16:31:13 2006 From: djohnson at apani.com (Johnson, Don) Date: Mon Apr 3 19:28:25 2006 Subject: [Wd_general] Compact Flash damaged after power failure Message-ID: <539E161543EA78418B9FF43566B97524012E42EF@SVRMAIL.apani.local> I have had very good luck using CF and ext3 in WD based router/nat boxes. Power failures are not a problem. CF incorporates wear balancing and distributes writes across the entire memory. If you need to write at times be sure to use the highest quality CF rather that the el cheapos. -----Original Message----- From: wd_general-bounces@lists.emji.net [mailto:wd_general-bounces@lists.emji.net] On Behalf Of Mark Phillips Sent: Monday, April 03, 2006 1:34 PM To: wd_general@lists.emji.net Subject: Re: [Wd_general] Compact Flash damaged after power failure Of course, the best option is to not write to the flash at all, and from your brief description, I see no reason to. Make sure you disable syslogging, and have no swap file; in fact, if your flash device has a write-protect, you can turn that on and see what craps out, and then remove whatever that is. (Others here may be able to give better advice - I'm not that much of an expert)... gary.james@criticallink.com wrote: >>Sean, >> I used to have similar problems with file system errors using ext2 if the system was shutdown >>improperly. I would suggest moving to a journaled file system like ext3 or reiser. >> >>chris > > > I am far from an expert, but I thought ext3 was not recommended for falsh based devices > because it causes excessive writes to the drive, thus hurting the life span of the drive. > > Gary James > > _______________________________________________ > Wd_general mailing list > Wd_general@lists.emji.net > http://lists.emji.net/mailman/listinfo/wd_general > _______________________________________________ Wd_general mailing list Wd_general@lists.emji.net http://lists.emji.net/mailman/listinfo/wd_general From jan.kardell at mida.se Tue Apr 4 09:52:55 2006 From: jan.kardell at mida.se (Jan Kardell) Date: Tue Apr 4 04:00:02 2006 Subject: [Wd_general] Compact Flash damaged after power failure In-Reply-To: <443186C8.801@alum.mit.edu> References: <002701c65727$692ff710$040aa8c0@prescott> <443142A0.13136.96DC7B@localhost> <443186C8.801@alum.mit.edu> Message-ID: <443225D7.4050803@mida.se> On my system I hacked rc.S to create ramdisks for /var and /dev, and to NOT remount / read/write. I choosed to do system setup (load my custom kernel drivers, setup nonstandard serial ports etc) and to start my app from rc.local. //Jan if [ ! "$DISMODE" = "run" ]; then # Remount the root filesystem in read-write mode echo "Remounting root device with read-write enabled." /sbin/mount -w -v -n -o remount / if [ $? -gt 0 ] ; then echo echo "Attempt to remount root device as read-write failed! This is going to" echo "cause serious problems... " echo echo "Normal bootdisks can be made to mount a system read-write with the rdev command:" echo echo "rdev -R /dev/fd0 0" echo echo "You can also get into your system by using a bootkernel disk with a command" echo "like this on the LILO prompt line: (change the root partition name as needed)" echo echo "LILO: mount root=/dev/hda1 rw" echo echo "Please press ENTER to continue, then reboot and use one of the above methods to" echo -n "get into your machine and start looking for the problem. " read junk; fi else # Mount and populate a ramdisk for temporary files echo "Making ramdisk for /var" /sbin/mke2fs -q /dev/ram1 4096 /sbin/mount /dev/ram1 /var if [ $? -gt 0 ] ; then echo echo "Attempt to mount ramdisk on /var failed!" read junk else /bin/mkdir --mode=755 /var/lock /var/log /var/pid /var/run /var/spool /bin/mkdir --mode=1777 /var/tmp /bin/ln -s /var/lock /var/locks /bin/ln -s /var/log /var/adm # Link for backwards compatibility with libc5 /bin/mkdir --mode=755 /var/lib /var/lib/zoneinfo /bin/ln -s /etc/localtime /var/lib/zoneinfo/localtime # Create a ramdisk for /dev echo "Making ramdisk for /dev" /bin/tar --create --file=/var/tmp/devs.tgz --gzip /dev /sbin/mke2fs -q -N 2048 /dev/ram2 384 /sbin/mount /dev/ram2 /dev if [ $? -gt 0 ] ; then echo echo "Attempt to mount ramdisk on /dev failed!" read junk else /bin/tar --extract --keep-old-files --preserve-permissions --file=/var/tmp/devs.tgz --gzip --directory=/ /bin/rm /var/tmp/devs.tgz fi fi fi Mark Phillips wrote: > > Of course, the best option is to not write to the flash at all, and from > your brief description, I see no reason to. Make sure you disable > syslogging, and have no swap file; in fact, if your flash device has a > write-protect, you can turn that on and see what craps out, and then > remove whatever that is. (Others here may be able to give better advice > - I'm not that much of an expert)... > > gary.james@criticallink.com wrote: > >>> Sean, >>> I used to have similar problems with file system errors using ext2 if >>> the system was shutdown improperly. I would suggest moving to a >>> journaled file system like ext3 or reiser. >>> >>> chris >> >> >> >> I am far from an expert, but I thought ext3 was not recommended for >> falsh based devices because it causes excessive writes to the drive, >> thus hurting the life span of the drive. >> >> Gary James >> >> _______________________________________________ >> Wd_general mailing list >> Wd_general@lists.emji.net >> http://lists.emji.net/mailman/listinfo/wd_general >> > _______________________________________________ > Wd_general mailing list > Wd_general@lists.emji.net > http://lists.emji.net/mailman/listinfo/wd_general > > From stephane.mouton at cetic.be Tue Apr 4 10:59:58 2006 From: stephane.mouton at cetic.be (=?ISO-8859-1?Q?St=E9phane_Mouton?=) Date: Tue Apr 4 15:40:52 2006 Subject: [Wd_general] Compact Flash damaged after power failure In-Reply-To: <539E161543EA78418B9FF43566B97524012E42EF@SVRMAIL.apani.local> References: <539E161543EA78418B9FF43566B97524012E42EF@SVRMAIL.apani.local> Message-ID: <4432277E.60105@cetic.be> I also got successful results using CF with a system onboard trucks (Linux WD) and subject to brutal loss of power (ex: mandatory for fuel delivery). The key factors to get a power fault tolerant system were : 1) The quality of the CF (as already mentioned in this thread) : we tested "supermarket" CF and experiencied size (once formatted) and performance differences between CF (even persistent problem on one sector of a CF causing problem in the dd command) . Professional grade CF (including in photograph shops) worked without encountering any problem. 2) The size of the CF : the smaller it is the quicker it reboots and restore (no problem on a 64Mb CF, experinced 1 problem on & 512Mb). Also try to use several partitions and set as much as you can as "read only". Though I tried with ext3, the definitive version used ext2 and it worked fine. But according to what I read in this mailing list, I believe that use of ext3 will just improve the strength of your system. At last, there is a bit of statistics in this problem, not just linux config. So don't hesitate to tell the list the result of your experiments, especially if you can test on a big set of CF. Best regards Johnson, Don a ?crit : > I have had very good luck using CF and ext3 in WD based router/nat > boxes. Power failures are not a problem. CF incorporates wear balancing > and distributes writes across the entire memory. If you need to write at > times be sure to use the highest quality CF rather that the el cheapos. > > -----Original Message----- > From: wd_general-bounces@lists.emji.net > [mailto:wd_general-bounces@lists.emji.net] On Behalf Of Mark Phillips > Sent: Monday, April 03, 2006 1:34 PM > To: wd_general@lists.emji.net > Subject: Re: [Wd_general] Compact Flash damaged after power failure > > > Of course, the best option is to not write to the flash at all, and from > > your brief description, I see no reason to. Make sure you disable > syslogging, and have no swap file; in fact, if your flash device has a > write-protect, you can turn that on and see what craps out, and then > remove whatever that is. (Others here may be able to give better advice > > - I'm not that much of an expert)... > > gary.james@criticallink.com wrote: > > >>> Sean, >>> I used to have similar problems with file system errors using ext2 if >>> > the system was shutdown > >>> improperly. I would suggest moving to a journaled file system like >>> > ext3 or reiser. > >>> chris >>> >> I am far from an expert, but I thought ext3 was not recommended for >> > falsh based devices > >> because it causes excessive writes to the drive, thus hurting the life >> > span of the drive. > >> Gary James >> >> _______________________________________________ >> Wd_general mailing list >> Wd_general@lists.emji.net >> http://lists.emji.net/mailman/listinfo/wd_general >> >> > _______________________________________________ > Wd_general mailing list > Wd_general@lists.emji.net > http://lists.emji.net/mailman/listinfo/wd_general > _______________________________________________ > Wd_general mailing list > Wd_general@lists.emji.net > http://lists.emji.net/mailman/listinfo/wd_general > > -- Stephane Mouton CETIC, Rue Clement Ader, 8 B-6041 Charleroi Belgium Tel.: +32 71 919 800 Fax.: +32 71 919 802