PuppyThis forum is for the discussion of Puppy Linux.
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.
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.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,159
Rep:
If the external drive was a usb it may have been asleep and needed to wake up before the copy could take place, also you would get better results when timing a command to use
As far as the cp program is concerned, the job is done. In reality, that data is sitting in the kernel's buffer cache and being flushed out to the disk in the background. If you've got a lot of memory, there can be gigabytes of data in those buffers. Run sync or unmount the filesystem to see how long the operation really takes.
TextFile='Speed.txt'
date "+ %m/%d/%y %r" >> $TextFile
gxmessage -timeout 2 "Copying largefile to sdb2."
time (cp largefile /mnt/sdb2) >> $TextFile 2>&1
echo ........................ >> $TextFile
#rm largefile
rm /mnt/sdb2/largefile
And the result of that is???
Note also that largefile might never be written to /mnt/sdb2. If you delete the file before the buffers have been flushed out, any pending writes are cancelled, and the data is never written to the drive. That happens a lot with short-lived files in /tmp, and is part of the reason that putting /tmp on a disk vs. putting /tmp in a tmpfs in RAM that is potentially swapped out to disk doesn't make a large difference in the amount of disk I/O that is performed.
Note: Please do not use [QUOTE] ... [/QUOTE] tags for purposes other than quoting other posts. It makes it hard to quote your content in a reply. Use [CODE] ... [/CODE] tags instead.
So would a sync before the deletion flush all the buffers ?
It would, but you have to include the time it takes for the sync to return. The cp command will still finish before the buffers are flushed, just as it did before.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.