zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Copying to USB HDD is very slow

Sun Oct 13, 2019 6:52 am

Seagate 8TB Backup Plus USB3 Hdd (formated with ext4) is very slow on my RPi3. If i download via ftp for example it is about 300KB/s while other usb drives and SD Card gives about 7MB/s. Local copying to it is also very slow. The strange thing is that if I copy to this drive connected to RPi from my Notebook over NFS it copies with 5MB/s. On RPi i have Raspbian 9 (stretch).

LTolledo
Posts: 2163
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Copying to USB HDD is very slow

Sun Oct 13, 2019 10:55 am

RPi3B has only USB2.0 ports.
smb copy over LAN connection gave me about 7MB/s

what does
hdparm -tT /dev/sda1 (assuming your HDD is auto-mounted as /dev/sda1) give you?
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Sun Oct 13, 2019 11:16 am

Code: Select all

sudo hdparm -tT /dev/sda1
/dev/sda1:
 Timing cached reads:   1282 MB in  2.00 seconds = 640.70 MB/sec
 Timing buffered disk reads:  16 MB in  3.33 seconds =   4.80 MB/sec
If i am on Pi and doing rsync locally (from one local usb drive to "problematic" local usb drive), it copies with 1MB/s, but if i am on my notebook an copying over nfs from/to same drives connected to RPi it is much faster and gives about 5MB/s. I noticed that this problem is mainly occurs if copying with sudo. Without sudo rsync local copy on RPi gives sometimes 20MB/s.

LTolledo
Posts: 2163
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Copying to USB HDD is very slow

Sun Oct 13, 2019 2:13 pm

just to compare, below is the output when I ran the same command on this SSD boot RPi3B Raspbian Stretch with Full Desktop.
with a hard disk (2.5" Marshal 1TB in Orico HDD to SATA case adapter) connected to the RPi3B via powered USB 2.0 hub

Code: Select all

 $ sudo hdparm -tT /dev/sdb1

/dev/sdb1:
 Timing cached reads:   1314 MB in  2.00 seconds = 657.03 MB/sec
 Timing buffered disk reads:  98 MB in  3.01 seconds =  32.51 MB/sec
the result of the buffered disk read is the expected value for a drive connected to a USB2.0 port of RPi

and here is there result when I plugged in my "very old" 2.5" 80GB PATA drive in a PATA to USB2.0 case

Code: Select all

~ $ sudo hdparm -tT /dev/sdb1

/dev/sdb1:
 Timing cached reads:   1174 MB in  2.00 seconds = 586.77 MB/sec
 Timing buffered disk reads:  88 MB in  3.05 seconds =  28.89 MB/sec
and its still within expectations
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Mon Oct 14, 2019 7:51 am

Today I started hdparm -tT /dev/sda1 again and "Timing buffered disk reads" was 28 MB/sec. Obviously first time was another process that was writing to hdd at the same time and this was the reason why "Timing buffered disk reads" was 4.80 MB/sec. But still I have problem that /dev/sda1 is very slow even if "sudo rsync" is only process that is writing to hdd.

User avatar
RaTTuS
Posts: 10506
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Copying to USB HDD is very slow

Mon Oct 14, 2019 8:14 am

buffered reads is a red herring

Code: Select all

dd if=/dev/zero of=test bs=524288 count=2048 
will write 1GB to your device in a file called test
change test to point to your mounted drive
and give the results

rsync will give various results depending on what it there already etc..
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

gkreidl
Posts: 6139
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Copying to USB HDD is very slow

Mon Oct 14, 2019 10:06 am

RaTTuS wrote:
Mon Oct 14, 2019 8:14 am
buffered reads is a red herring

Code: Select all

dd if=/dev/zero of=test bs=524288 count=2048 
will write 1GB to your device in a file called test
change test to point to your mounted drive
and give the results

rsync will give various results depending on what it there already etc..
FYI, on my RPi 3B this gives 27,5 MB/s (USB HDD connected via USB2)

On my RPi 4B I get 142 MB/s (USB HDD connected via USB3)
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Mon Oct 14, 2019 10:22 am

RaTTuS wrote:
Mon Oct 14, 2019 8:14 am
buffered reads is a red herring

Code: Select all

dd if=/dev/zero of=test bs=524288 count=2048 
will write 1GB to your device in a file called test
change test to point to your mounted drive
and give the results

rsync will give various results depending on what it there already etc..

I am getting 3,7 MB/s:

Code: Select all

pi@raspberrypi:/media/usb0/Tests $ dd if=/dev/zero of=./test bs=524288 count=2048
2048+0 records in
2048+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 293,408 s, 3,7 MB/s

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Tue Oct 15, 2019 3:54 pm

Following I am getting on RPi (usb0 connected to RPi):

Code: Select all

pi@raspberrypi:~ $ dd if=/dev/zero of=/media/usb0/Tests/test bs=524288 count=2048
2048+0 records in
2048+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 296,676 s, 3,6 MB/s

and this I am getting on my notebook on the same folder connected with NFS:

Code: Select all

user@notebook:/media/user/NFS/Tests$ dd if=/dev/zero of=test bs=524288 count=2048
2048+0 Datensätze ein
2048+0 Datensätze aus
1073741824 Bytes (1,1 GB, 1,0 GiB) kopiert, 193,729 s, 5,5 MB/s
Why writing over network is faster than local writing?

User avatar
RaTTuS
Posts: 10506
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Copying to USB HDD is very slow

Tue Oct 15, 2019 4:08 pm

what filesystem are you running on those usb drives
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Tue Oct 15, 2019 5:41 pm

In both cases it is the same disk and it is ext4. It is connected to RPi. In first case i am starting dd on RPi directly, and in second case i am starting dd on my notebook over NFS mount pointing to the same disk connected to RPi.

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Tue Oct 15, 2019 6:50 pm

If this hdd connected to notebook directly, it gives 42,1 MB/s:

Code: Select all

$ dd if=/dev/zero of=test1 bs=524288 count=2048
2048+0 Datensätze ein
2048+0 Datensätze aus
1073741824 Bytes (1,1 GB, 1,0 GiB) kopiert, 25,5065 s, 42,1 MB/s
even if I connect hdd directly to very old RPi1 it gives me 12.0MB/s

zeitalex
Posts: 13
Joined: Sun Mar 06, 2016 7:05 am

Re: Copying to USB HDD is very slow

Wed Oct 16, 2019 3:09 am

If after reboot I unmount hdd and do

Code: Select all

sudo mount /dev/sda1 /media/usb0/
then I am able to write to it with 36,1 MB/s

Probably something is wrong in my fstab:

Code: Select all

PARTUUID=25d6e1ac-01  /boot           vfat    defaults          0       2
PARTUUID=25d6e1ac-02  /               ext4    defaults,noatime  0       1

UUID=fb769947-7836-4897-b2fd-107a6718e413   /media/usb0   ext4   auto,nofail,sync,users,rw   0   0
UUID=1BFD083548529955 /media/usb1 ntfs auto,users,rw 0 0

Kendek
Posts: 128
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Copying to USB HDD is very slow

Wed Oct 16, 2019 6:35 am

zeitalex wrote:
Wed Oct 16, 2019 3:09 am

Code: Select all

sudo mount /dev/sda1 /media/usb0/
then I am able to write to it with 36,1 MB/s

Probably something is wrong in my fstab:

Code: Select all

UUID=fb769947-7836-4897-b2fd-107a6718e413   /media/usb0   ext4   auto,nofail,sync,users,rw   0   0
Yes, the sync mount option.

Return to “Troubleshooting”