• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: File empty after cutting of the power  (Read 667 times)
JonasR
Newbie
*

Karma: 0
Posts: 18


View Profile
« on: October 26, 2010, 07:49:06 AM »

Hi,

i've got a problem, if I remove the power cord after writing a file and boot the plug again the file is empty. So I'm really sure its a problem with the filesystem(ubifs). I read that it caches the files before writing. So how can I force to write?

Thanks
Logged

MarkF
Full Member
***

Karma: 7
Posts: 144


View Profile
« Reply #1 on: October 26, 2010, 11:22:23 AM »

Before pulling the power, use the "shutdown -h now" command from a shell and it will force a flush of the cache before halting.

From inside a program, I think fsync(handle) done before close(handle) does this.
Logged

Mark

JonasR
Newbie
*

Karma: 0
Posts: 18


View Profile
« Reply #2 on: October 27, 2010, 11:40:28 PM »

Thanks for you reply.

The problem is that some customers wont type in the halt command for shutting it down :/
So I got to take the fsync method. Ill test how to handle this with perl and write it later in here Wink

Logged

Pages: [1]
Print
Jump to: