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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-10-2015, 03:30 AM
|
#1
|
LQ Newbie
Registered: Aug 2014
Posts: 8
Rep:
|
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
|
|
|
06-10-2015, 05:36 AM
|
#2
|
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
|
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.
|
|
|
06-10-2015, 08:18 AM
|
#3
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,914
|
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.
|
|
|
06-13-2015, 10:51 AM
|
#4
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,961
|
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!
|
|
|
06-14-2015, 02:11 AM
|
#5
|
LQ Newbie
Registered: Aug 2014
Posts: 8
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 10:11 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|