Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Linux, protecting SD-card file system from power down

Status
Not open for further replies.

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,215
Helped
451
Reputation
902
Reaction score
412
Trophy points
1,363
Location
Sweden
Activity points
9,414
I have an embedded linux system with a mounted SD-card.
Normally, only read operations are done, but sometimes a file must be updated.
What is the best way to minimize the risk for a corrupted file system?
Power down can occur at any time.

Here are the two alternatives I'm considering now:

1. The file system is normally mounted "rw" (read/write).
After a write, the "sync" command is executed immediately to flush the buffers and write to the SD-card.

2. The file system is normally mounted "ro" (read only).
Before a write, the file system is remounted as "rw".
After the write, it is remounted again as "ro".

Alternative 1 can probably not be safer than alternative 2, but maybe they are equal?
Are there other alternatives?
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,215
Helped
451
Reputation
902
Reaction score
412
Trophy points
1,363
Location
Sweden
Activity points
9,414

skogsjanne

Full Member level 3
Joined
May 28, 2009
Messages
172
Helped
26
Reputation
52
Reaction score
26
Trophy points
1,308
Activity points
2,084
I always use noatime and have never seen any problem with that.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top