Overcoming USB copy delay
Moderator: Forum moderators
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Overcoming USB copy delay
However - the downside of this has been that the write process has to play "catchup" at inconvenient times - such as at shutdown or when trying to unmount drives etc, which means that the user had to wait for the data to be transferred out of memory - even if it took minutes to transfer a couple of gigs across a slow bus onto a slow usb stick.
I experienced data corruption at times which i attributed to my having pulled usb sticks out of the PC before such data transfers had finished. The problem was that the system would say that the transfer had finished when in fact it was still underway.
If a usb stick had an LED which flashed to indicate the data transfer i could tell that i should wait - but with no LED it was pot luck.
These days I still experience the problem where the data is still transferring long after it appears that the copy has ended - but now i know to use the "sync" command in a terminal to force the data to transfer out of memory - and i wait for the terminal prompt to re-appear before pulling the stick.
What i am wondering is if there is some way to force any given write to begin immediately and tell me truthfully when it has finished?
Let me offer an example: lets say i have a 3GB video file in /root and want to copy it to a usb stick - i can start the copy (rox window to rox window) and hope that the transfer will start immediately but really i have no idea when the system will start to flush the data from memory (which is where /root lives...).
This is especially problematic if i am generating other NEW video files at the same time and filling up /root and approaching the limit of my personal save space (which is a total of system RAM + swap partition).
So my question is: is there any way to overcome the inherent write delay and tell the system that i want a specific copy to start NOW and complete as soon as possible (and that i dont care about preserving usb stick life)?
I dont want to have the uncertainty of thinking that my RAM is running out simply because the system is not planning on emptying RAM writes until it decides that some random timer will run out in x minutes and force the usb writes then.
Hope that makes sense.
I am guessing that there is some PUPMODE that will correct this anomaly - although i really want this to be under my manual control rather than treating my usb sticks as HDDs and writing at all times. I seem to be currently running PUPMODE 5 (system boots from usb and has no savefile).
- taersh
- Posts: 951
- Joined: Tue Jul 07, 2020 11:13 pm
- Location: Germany
- Has thanked: 53 times
- Been thanked: 119 times
Re: Overcoming USB copy delay
My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
Re: Overcoming USB copy delay
Use the "sync" mount option.
Code: Select all
mount -o sync /dev/sdb2 /mnt/sdb2
Hope that helps ^_^
- bigpup
- Moderator
- Posts: 6980
- Joined: Tue Jul 14, 2020 11:19 pm
- Location: Earth, South Eastern U.S.
- Has thanked: 902 times
- Been thanked: 1520 times
Re: Overcoming USB copy delay
I am a little confused.I seem to be currently running PUPMODE 5 (system boots from usb and has no savefile
Is this the way you always run?
Pupmode 5 only uses a ramdisk for save.
After you actually make a save file/folder and boot using the save.
Normally, a USB install will be running in pupmode 13.
How much RAM is in the computer?
I wonder if your issues, are trying to do too much, with too little RAM.
I hate to say it, but Puppy is not that good at warning about running out of RAM.
Also, if you have a swap file or partition.
Running in pupmode 5 is going to cause use of the swap, if the ramdisk is running out of RAM.
There is also the setting that controls when swap is used. At what percent level of RAM usage.
Also, you could have a large usage of RAM cache going on.
The cache would have to clear, to give more free RAM, for the ramdisk to use.
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected
- mikewalsh
- Moderator
- Posts: 6150
- Joined: Tue Dec 03, 2019 1:40 pm
- Location: King's Lynn, UK
- Has thanked: 788 times
- Been thanked: 1976 times
Re: Overcoming USB copy delay
Tell me about it..! And this is one of the primary reasons I've upped the original 4 GB in this new HP desktop all the way to 16 GB. I had enough years of having to watch the amount of RAM in use with the old Compaq's 3 GB..... Now, I can do whatever I want, secure in the knowledge that I'm never getting anywhere near the system's limits.bigpup wrote: ↑Sun Aug 23, 2020 3:23 pm<snip>....How much RAM is in the computer?I seem to be currently running PUPMODE 5 (system boots from usb and has no savefile
I wonder if your issues, are trying to do too much, with too little RAM.
I hate to say it, but Puppy is not that good at warning about running out of RAM....</snip>
I may yet go to 32 GB. Haven't decided yet...
(*shrug*)
Mike.
Re: Overcoming USB copy delay
As a matter of course, I always issue the 'synch' command and allow it to complete before removing storage devices.
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
Thanks - just tried this idea and got unexpected results.garnet wrote: ↑Sun Aug 23, 2020 2:32 pm Use the "sync" mount option.Assuming your usb stick is /dev/sdb2.Code: Select all
mount -o sync /dev/sdb2 /mnt/sdb2
If i mount async it takes about 10 seconds to copy a 100MB file to the stick (and the copy dialog disappears halfway through the actual copy)
If i mount using sync it takes about 3 or 4 minutes to do the copy - but the copy dialog stays open until the writes have actually finished and the LED stops flashing.
Not sure what to make of this - more testing required.
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
Yes this is how my system has been running for the last 5 years. (It is probably a distraction if i explain how my pup is set up but basically i used jrb's technique of swapping the zdrv with the main pup.sfs so that my personalisations are in the zdrv and as a result i don't need a savefile)
I have 2GB of RAM - but a 6GB swap partition. What i find is that the system uses the swap partition as if it was RAM - so that i can copy a 3GB video file into /root and manipulate it quite happily with ffmpeg or similar (which can potentially double the RAM requirements and runs close to stalling the pup once the swap is all used up...). Seems as if i could happily add 20GB of swap rather than trying to double the internal RAM - so i never bothered to increase the internal.How much RAM is in the computer?
Yes the problem with running out of free RAM is caused by having too little memory - i know that i can get past that problem by adding more sodimms, or by adding more swap partition space, or by limiting the size of video files that i am manipulating. But the problem with puppy not writing data OUT of /root as soon as i start a copy is a different problem. Sometimes i just want to ditch some data out of root and i want it gone now rather than waiting for it to decide it is ready to run a sync and flush the requested "copy" out of memory.I wonder if your issues, are trying to do too much, with too little RAM.
(I can manually force it with the "sync" command but i would like to make it happen automatically as soon as i command Rox to do the copy)
I agree. I read in various places that "Linux is good at managing swap functions" - yet i don't see that on my system. Never any warnings, just dead in the water once the bottom rung of the "partview" icon starts flashing red.I hate to say it, but Puppy is not that good at warning about running out of RAM.
But in all fairness - i should have noticed the partview icon stepping down to orange - and got my other "root file dump" copies out of the way sooner.
Swap usage has always been an oddball thing to me. It almost never looks as if swap is in use - but then if i copy a massive file to /root (or other non-HDD directory) it seems happy to use the swap to hold that file as if it was just extended RAM. Seems all or nothing. Like swap is "shut for business" until the exact moment when puppy is about to die - then the swap door opens and all is good. (Till swap hits 99% full and puppy goes fully tits up).Also, if you have a swap file or partition.
Running in pupmode 5 is going to cause use of the swap, if the ramdisk is running out of RAM.
There is also the setting that controls when swap is used. At what percent level of RAM usage.
Got me there - cache is a mystery to me.Also, you could have a large usage of RAM cache going on.
The cache would have to clear, to give more free RAM, for the ramdisk to use.
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
Well i do want the copy dialog to stay open until the copy is finished - but i don't want the copy to take ten times as long in syncmount as it did in asyncmount.
(The actual data transfer took ten times as long using sync mount)
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
Re: Overcoming USB copy delay
What is the filesystem on the usb stick? I hope it is not ext3 or ext4?
How much is the total time to: copy in asyncmount + run "sync" in terminal and waits until the "sync" is completed? I think this total should be the same as copy in syncmount, no?
Hope that helps ^_^
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
Try loading 16GB or more of video files into /root and see if you can pick the exact point when the pup clags up.mikewalsh wrote: ↑Sun Aug 23, 2020 4:56 pm I've upped the original 4 GB in this new HP desktop all the way to 16 GB. I had enough years of having to watch the amount of RAM in use with the old Compaq's 3 GB..... Now, I can do whatever I want, secure in the knowledge that I'm never getting anywhere near the system's limits.
I may yet go to 32 GB. Haven't decided yet...
Then repeat the process after plugging in a fast 16GB usb stick formatted as swap and see if this allows you to treat the system as if it had double the RAM.
I would be keen to see the result.
(Obviously usb swap is slow - but at least it should stop the total clag-out of memory processes).
I think i will need to make it a habit to plug in extra swap on-the-fly when i notice my partview going orange.
- taersh
- Posts: 951
- Joined: Tue Jul 07, 2020 11:13 pm
- Location: Germany
- Has thanked: 53 times
- Been thanked: 119 times
Re: Overcoming USB copy delay
From my experience swap is a fake. Ok, it may save the computer needing to be shut off by pressing the reset button, but any useful use isn't possible then until the RAM usage gets much lower. When the RAM returns to default usage by a few GB around 4GB the swap doesn't return to zero. It keeps several hundred MB up to 1.5 GB.
My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
Re: Overcoming USB copy delay
Code: Select all
echo 10 > /proc/sys/vm/swappiness
Hope that helps ^_^
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
I get caught by the deception of the rox "copy" dialog disappearing before the data is actually written out. In part this is because the data is sometimes only being written to RAM (and the auto sync will occur later), but sometimes if the file is big enough the rox dialog closes half way through the actual data transfer.
I believe there are some Pup modes where data writing is not delayed - it starts as soon as the copy dialog is begun.
I hope i can access that functionality without experiencing the super slow data transfer i saw when i tried Garnets suggestion of the sync mount.
(A bit of Googling suggests sync mount is pretty much never used - so i doubt that is the mechanism Puppy uses when in a pupmode that writes immediately to disk)
- taersh
- Posts: 951
- Joined: Tue Jul 07, 2020 11:13 pm
- Location: Germany
- Has thanked: 53 times
- Been thanked: 119 times
Re: Overcoming USB copy delay
Code: Select all
sysctl vm.swappiness=10
Code: Select all
echo 10 > /proc/sys/vm/swappiness
My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
Re: Overcoming USB copy delay
Not "sometimes", but "always", unless one uses "sync" mount option.
You do get the guarantee that your data is on the stick, though (⌒‿⌒)I hope i can access that functionality without experiencing the super slow data transfer i saw when i tried Garnets suggestion of the sync mount.
PUPMODE=5 ?(A bit of Googling suggests sync mount is pretty much never used - so i doubt that is the mechanism Puppy uses when in a pupmode that writes immediately to disk)
Same (⌒‿⌒)taersh wrote: ↑Mon Aug 24, 2020 3:42 am I have a script running at boot that already sets the swappiness to 10.Is that different toCode: Select all
sysctl vm.swappiness=10
???Code: Select all
echo 10 > /proc/sys/vm/swappiness
Hope that helps ^_^
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
True. And that is the important outcome. But is that the only impact i wonder? It seems to me that the sync mount must have some other impact that causes a slower data transfer rate to the usb stick. I want to investigate that further on other more standard pups. May have just been a temporarily anomaly.
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
In order to avoid any contributing factors from Rox-Filer i wrote the following script:
Code: Select all
#! /bin/bash
gxmessage " Click ok to start copy now.
You will receive a confirmation when copy is finished.
You will also be advised of start and stop times."
STARTDATE=$(date)
cp -f /root/test.iso /mnt/sdd1
sync
ENDDATE=$(date)
gxmessage " Copy is finished.
Start time was $STARTDATE and end time was $ENDDATE
Subtract start time from end time to calculate elapsed time for copy"
# mount -o sync /dev/sdd1 /mnt/sdd1
and
# mount -o async /dev/sdd1 /mnt/sdd1
The sync mount copy took 3 minutes and 28 seconds.
The async mount copy took only 11 seconds.
In each case the usb stick LED flashing stopped at the same time as the script ended - so i believe these figures measured accurately the time taken to transfer the data.
I am not sure what exactly is happening with sync mount. Keen to hear if other peoples pups and usb sticks show similar characteristics.
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
http://murga-linux.com/puppy/viewtopic. ... 57#1034582
This sounds like something i could benefit from so i gave Don570's rightclick version of copyfast a try and it is promising - although instead of a copy window it seems to pop up a yafsplash or similar for the duration of the copy - but that message disappears behind other windows and drops out of the users view.
Maybe i can modify it to stay on top.
- garnet
- Posts: 66
- Joined: Tue Aug 04, 2020 2:21 pm
- Location: Alexandria
- Has thanked: 6 times
- Been thanked: 12 times
Re: Overcoming USB copy delay
better-linux-disk-caching-performance-vm-dirty_ratio
Hope that helps ^_^
- Flash
- Moderator
- Posts: 975
- Joined: Tue Dec 03, 2019 3:13 pm
- Location: Arizona, U.S.
- Has thanked: 51 times
- Been thanked: 125 times
Re: Overcoming USB copy delay
- Attachments
-
- copy-fast-2.7.pet.sfs
- (12 KiB) Downloaded 26 times
-
- copy-fast-2.7.pet
- (12.6 KiB) Downloaded 27 times
Re: Overcoming USB copy delay
Do some benchmarking from the console.
Code: Select all
cp test.file /mnt/sdb1;sync
You never see the problem copying on fixed disks. It just buffers in the background as you go on your merry way with what you wanted to do. The buffered data finishes writing out in the background.
The problem only becomes an issue with removable media.
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Overcoming USB copy delay
Hi Flash,
yes i did try copyfast and it definitely reports accurate timing of "copy finished" - please see my post a couple of posts above your one. I think Copyfast and rsync is the answer i needed - although Copyfast uses a yaf-splash advisory dialog that does not stay on top of other windows and therefore risks leaving me in the dark just as much as Rox Filers copy dialog.
If i can solve the issue of the dialog window disappearing from view Copyfast will be a good alternative to Rox.
Tried replacing Copyfast's yaf-splash dialog with gxmessage as an alternative but my gxmessage version does not allow "ontop" functionality so no gain there.
- vtpup
- Posts: 735
- Joined: Sat Aug 15, 2020 2:34 pm
- Location: Republic of Vermont
- Has thanked: 198 times
- Been thanked: 163 times
- Contact:
Re: Overcoming USB copy delay
Forum console workarounds for data transfer notifications aside, no responsible OS GUI should indicate the un-mounting operation to an external USB device is completed when it isn't. That seems basic.
HP Envy Laptop 17t-cr100
Fossapup F-96 CE rev 4
Huge kernel: huge-6.1.8-fossapup64
My homemade foam boat:
www.youtube.com/watch?v=4sDubB0-REg
- Flash
- Moderator
- Posts: 975
- Joined: Tue Dec 03, 2019 3:13 pm
- Location: Arizona, U.S.
- Has thanked: 51 times
- Been thanked: 125 times
- vtpup
- Posts: 735
- Joined: Sat Aug 15, 2020 2:34 pm
- Location: Republic of Vermont
- Has thanked: 198 times
- Been thanked: 163 times
- Contact:
Re: Overcoming USB copy delay
Is it okay to frustrate them with file corruptions? Do we want people to think this is a usable OS?
This is a basic GUI bug, plain and simple.
HP Envy Laptop 17t-cr100
Fossapup F-96 CE rev 4
Huge kernel: huge-6.1.8-fossapup64
My homemade foam boat:
www.youtube.com/watch?v=4sDubB0-REg
- Flash
- Moderator
- Posts: 975
- Joined: Tue Dec 03, 2019 3:13 pm
- Location: Arizona, U.S.
- Has thanked: 51 times
- Been thanked: 125 times