0

I have a Raspberry PI 4 (4GB) with raspbian OS lite installed.

I am trying to copy data from one hard disk to another and every time the transfer fails after copying few files and the drives are unmounted.

Strangely or not, 10 out of 10 times I can transfer data between same two hard disks on different laptop running Ubuntu. The data is around 65GB.

The drives are never auto mounted so below is the fstab I am using to mount the drives. UID=GID=1002 is a user having same rights as user pi.

When I copy, I am logged in with the 1002 user.

LABEL=backup    /mnt/backup             ntfs-3g uid=1002,gid=1002,umask=077,fmask=077,defaults,auto,nofail,noatime      0       2
LABEL=Personal  /mnt/source/personal    ext4 defaults,auto,nofail,noatime                                               0       2
LABEL=Media     /mnt/source/media       ntfs-3g uid=1002,gid=1002,umask=077,fmask=077,defaults,auto,nofail,noatime      0       2
LABEL=Work      /mnt/source/work        ext4 defaults,auto,nofail,noatime                                               0       2

Below are the errors I get:

When using cp -rv /mnt/source/media/ /mnt/backup/

cp: cannot stat '/mnt/source/media/Books': No such file or directory

When using rsync -htrvP /mnt/source/media/ /mnt/backup/

sending incremental file list
./
rsync: failed to set times on "/mnt/backup/AWS-Dev": Input/output error (5)
default_perms_for_dir: sys_acl_get_file(AWS-Dev, ACL_TYPE_DEFAULT): Input/output error, falling back on umask
rsync: recv_generator: failed to stat "/mnt/backup/AWS-Dev/0.mp4": Input/output error (5)

When using rsync -htrvP --omit-dir-times /mnt/source/media/ /mnt/backup/

sending incremental file list
rsync: recv_generator: mkdir "/mnt/backup/AWS-Dev" failed: Input/output error (5)
*** Skipping any contents from this failed directory ***

Most of the times only backup drive gets unmounted and below is how it looks after ls command

Screenshot of error after ls command

This is how it usually looks:

Screenshot of successful ls command

Also, strangely when drives are plugged in the Pi, they make a lot of clicking noise while there's almost no noise when these drives are connected to the other laptop.

I am trying various solutions from various forums but no success. I tried various forums for answers where the suggestions were mostly like the drive is dying, I ran a disk check, got only 8 bad sectors on the backup drive. I reformatted to ext4 then to ntfs with no change in results. Tried both drive plugged to USB3 ports and then both to normal USB port. Only once with both on normal USB ports the rsync went a lot longer than other times but failed eventually.

As said previously, on other laptop the transfer is always successful and on pi never.

I am not a linux poweruser and completely clueless now.

Note: The pi is new and both hard drive enclosures are new and are USB3.

Chenmunka
  • 625
  • 6
  • 15
  • 27
user3275095
  • 105
  • 1
  • 5
  • the difference between what you're doing on the pi and what happens on the laptop (assuming Windows laptop) is that NTFS is a Windows native filesystem ... – Jaromanda X Mar 12 '21 at 05:21
  • The other laptop is ubuntu and tried with ext4 as well. – user3275095 Mar 12 '21 at 08:42
  • oh, then my comment makes no sense – Jaromanda X Mar 12 '21 at 09:02
  • 2
    Are both the enclosures powered by the USB ports? If the answer is 'yes', that's your problem, as the Pi can only supply 1.2A total to all USB ports combined, and each USB external drive will need around 1.0A when spinning up or seeking. – Michael Harvey Mar 12 '21 at 09:10
  • 1
    It is most likely an electrical problem, like insufficient power, poor usb connection etc. Look in your kernel log files for messages. I don't know what raspian uses for logging so try as root journalctl, dmesg, and look in /var/log/ for recently changed files that may be logs. – meuh Mar 12 '21 at 13:40
  • @MichaelHarvey Thanks for the pointer. Seems logical. I'll buy a powered USB hub and try again in few days. – user3275095 Mar 12 '21 at 14:07
  • @meuh I'll try again and post the dmesg log here. – user3275095 Mar 12 '21 at 14:10
  • 1
    I wrote from experience. I have a Raspberry Pi 4 and it was very happy with a 2.5 inch 'portable' 1TB Toshiba Canvio USB3 hard drive, powered from the USB port. I got a similar USB3 2TB WD Elements drive and connected it and immediately had the same signs as @user3275095 that is frequent chirps and clicks, drives getting unmounted, disk error messages in /var/log/syslog, often failing to boot at all. From posts on the official Raspberry Pi Forum, you might get lucky with 2 USB SSDs. – Michael Harvey Mar 12 '21 at 15:03

1 Answers1

2

Unless your HDDs are powered externally or you have a mod similar to this one, this is most likely due to insufficient power. USB disks consume less power when idle (just spinning), once you actively use them additional motors which move the heads are powered. Most USB HDDs have a rated current between 0.6 and 1 A, and 2 x 0.6 A is already at the limit of what the Pi can provide.

Clicking noise is a good indicator of an HDD trying to power the motor, failing due to low voltage, trying again, etc.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144