Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Nov 2022 20:55:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 268005] rsync to FAT32 flash drive gets "Freeing unused sector" errors
Message-ID:  <bug-268005-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268005

            Bug ID: 268005
           Summary: rsync to FAT32 flash drive gets "Freeing unused
                    sector" errors
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: wbe@psr.com

Summary:

rsync copying to a mounted FAT32 flash drive is getting
"Freeing unused sector" errors.  First seen Sept. 10.

Keywords: msdosfs, rsync, flash drive, "Freeing unused sector"

What fails:

* rsync from HDD to a mounted FAT32 flash drive.

* The error is always kernel: "Freeing unused sector".

Things worked fine under FreeBSD 13.0-RELEASE-p12 for amd64 and (I think)
rsync 3.2.5.

* The system was upgraded to FreeBSD 13.1-RELEASE-p2 and rsync 3.2.6 on 8/3=
1.
  The problem first appeared on 9/10.  As of -p4, it is still occurring.

* It doesn't always happen (see below), but some cases are more likely to
  trigger the problem.

Related things that haven't experienced the problem:

* rsync to flash drives with a UFS file system continues to work fine.  The
  problem has only appeared with flash drives using MSDOS/FAT32.

* cp -pR of gigabytes of data from HDD to the FAT32 flash drive did fine.
  I've only seen the problem arise when using rsync.

More:

* I cp'd the flash drive's 7.1GB of files to HDD, did a complete reformat of
the
  drive (not a "quick" format), and cp'd all the saved files back.  That all
  went fine.  I then ran rsync and the error arose again relatively quickly.

* After getting the unused sector error, I ran Win10's "Scan and Repair" on=
 the
  drive.  It says "Your drive has been successfully repaired", indicating t=
hat
  the corruption, however it happened, appears to be real.

* Reading from the drive seems to work fine.

Discussion:

At first, since it was happening with an old 8GB flash drive I'd used for
years,
I figured maybe it was just wearing out.  So, I got a brand new, fresh out =
of
its package, 16GB flash drive.  rsync ran for good while but the same error
("Freeing unused sector") happened.  Once again, Win10 "Scan and Repair" sa=
id
successfully repaired, indicating there was at least one problem.  [It says=
 no
errors if there were no errors.]

I *don't* believe the new drive is hardware flaky.  I especially don't beli=
eve
a
brand new flash drive would be the exact same kind of flaky as the old driv=
e.
This is what leads me to think some sort of bug has crept in to either
FreeBSD's
msdosfs code or rsync (or one of its libraries).

Log file details:

The first occurrence:  {mildly edited}

  [I plug in the old USB flash drive]
Sep 10 09:31:17 kernel: usb_msc_auto_quirk: UQ_MSC_NO_GETMAXLUN set for USB
mass storage device UFD USB Flash Drive (0x{#}:0x{#})
Sep 10 09:31:20 kernel: usb_msc_auto_quirk: UQ_MSC_NO_PREVENT_ALLOW set for=
 USB
mass storage device UFD USB Flash Drive (0x{#}:0x{#})
Sep 10 09:31:20 kernel: ugen2.6: <UFD USB Flash Drive> at usbus2
Sep 10 09:31:20 kernel: umass0 on uhub2
Sep 10 09:31:20 kernel: umass0: <UFD USB Flash Drive, class 0/0, rev
2.00/11.00, addr 6> on usbus2
Sep 10 09:31:20 kernel: umass0:  SCSI over Bulk-Only; quirks =3D 0x8100
Sep 10 09:31:20 kernel: umass0:6:0: Attached to scbus6
Sep 10 09:31:23 kernel: da0 at umass-sim0 bus 0 scbus6 target 0 lun 0
Sep 10 09:31:23 kernel: da0: <UFD USB Flash Drive 1100> Removable Direct Ac=
cess
SCSI device
Sep 10 09:31:23 kernel: da0: Serial Number {its serial #}
Sep 10 09:31:23 kernel: da0: 40.000MB/s transfers
Sep 10 09:31:23 kernel: da0: 7648MB (15663104 512 byte sectors)
Sep 10 09:31:23 kernel: da0: quirks=3D0x2<NO_6_BYTE>
  [mount_msdosfs is run to mount da0s1 on my mount point.]
  [I run rsync]
Sep 10 09:50:32 kernel: {mymountpoint}: Freeing unused sector 983552 0 0
Sep 10 09:50:32 kernel: /dev/da0s1: remounting read-only due to corruption

Here are error lines from other times (same flash drive).  The sector info
changes:

Sep 20 17:32:28 kernel: {mymountpoint}: Freeing unused sector 457900 12
fe000000
  and
Nov 21 00:19:09 kernel: {mymountpoint}: Freeing unused sector 8816 16 b3c07=
fff
  and
Nov 26 00:56:50 kernel: {mymountpoint}: Freeing unused sector 185786 26
da000000
  This last one occurred following the complete reformat, so there shouldn't
  have been any file system problem at mount time.

Today, the same problem happened with the brand new drive:
Nov 26 08:07:11 kernel: da0: 14976MB (30670848 512 byte sectors)
Nov 26 10:10:18 kernel: {mymountpoint}: Freeing unused sector 957732 4 ffff=
fe00
  and a bit later:
Nov 26 14:18:49 kernel: {mymountpoint}: Freeing unused sector 943666 18
fffbaf7f

What seems to make the problem more likely to occur:

On the old drive, the majority of the files hadn't changed since the previo=
us
rsync, so rsync did lots of reading and comparing, but not that much writin=
g.
The problem occurred.

The first time I ran rsync with the new drive, none of the old files were
there,
so rsync was mostly writing some 7GB.  That went fine, just like the 7GB cp=
 to
the old drive went fine.  Then, the second time, I'd changed the rsync comm=
and
to include 2 directories I'd excluded the first time, and it was while writ=
ing
those files that it died with the log entries above.

For now, it looks like rsync to a FAT32/512 flash drive is unreliable.
I hope this can get fixed.
 -WBE

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268005-227>