LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-10-2015, 03:30 AM   #1
Mechi
LQ Newbie
 
Registered: Aug 2014
Posts: 8

Rep: Reputation: Disabled
on embedded Ubuntu, how to guarantee that files are actually copied?


I copy files from an SD card to the NAND file system, or vice versa using cp command line.

If I don't wait 3-4 minutes, and remove the disk, the files are not copied.
Also, if I try copying files from one directory to another - the 'ls -l' shows that the files have been copied (time, size have changed), but if I power off the system too quickly (without waiting 3-4 minutes) the files have been erased with nothing copied.

How can I check, flush or guarantee that the entire file has been copied correctly?

Using Ubuntu 10.4 on ARM.

Thanks,
Mechi
 
Old 06-10-2015, 05:36 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Depending on how you too quickly power off the system the data just did not got written to the disk but only to the cache. On normal shutdowns the disk cache is written to the disk. Also I just read that it only waits a few second till the synchronisation happened.

Use the sync command to have the cache beeing written to the disk. To check on the actuall cache or if there are still data lingering to be written I'm not so sure if free will tell you. Maybe this link can shed some more light: http://www.linuxatemyram.com/play.html. Or take a journey into the /proc directory and see if you can find some info there.
 
Old 06-10-2015, 08:18 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,914
Blog Entries: 13

Rep: Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948
When you power off the system, what are you doing? Just pulling the plug? You should issue "poweroff" or "shutdown -h now".

Yes the sync command is also the correct thing to do here, and then it wouldn't matter if you didn't shut off the system.
 
Old 06-13-2015, 10:51 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,961
Blog Entries: 46

Rep: Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188Reputation: 3188
Member response

Hi,

Be sure to learn the use of 'man command'. From 'man sync';
Quote:
NAME
sync - flush file system buffers

SYNOPSIS
sync [OPTION]

DESCRIPTION
Force changed blocks to disk, update the super block.

--help display this help and exit

--version
output version information and exit
I like to provide this to users;
Quote:
Just a few more links to aid you to gaining some understanding. Sure some may seem beyond a newbie but you must start somewhere;


Hope this helps.
Have fun & enjoy!
 
Old 06-14-2015, 02:11 AM   #5
Mechi
LQ Newbie
 
Registered: Aug 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for all of the ideas and extra information.
I will definitely try them, though on embedded Linux not all of the functions are supported in the BusyBox. I do see the 'sync' function in /bin.
Thanks again,
Mechi
 
  


Reply

Tags
copy, flush


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to tell which files have been copied or modified stagnitto Linux - Security 2 10-02-2007 10:51 AM
Root cannot modify files in any way. Copied files from slackware. CrAzY G Fedora 1 01-08-2007 10:18 AM
Samba Files Have to be Copied? digitalc Linux - Software 2 01-08-2006 02:59 AM
files being copied into root mercy420 Slackware 1 06-18-2005 08:23 AM
No files are copied to disk capodan Slackware 2 05-19-2003 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration