View previous topic :: View next topic |
Author |
Message |
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Sat Aug 31, 2024 11:19 am Post subject: |
|
|
I don't quite understand what the significance of this is since ntfs works fine on all systems.
I can say that both the "native support" and "FUSE" options are activated in my kernel according to https://wiki.gentoo.org/wiki/NTFS. Also the ntfs3g package is installed on both systems.
dmesg, nothing about ntfs:
Quote: | [ 44.491454] usb 4-3: new SuperSpeed USB device number 2 using xhci_hcd
[ 44.503988] usb 4-3: LPM exit latency is zeroed, disabling LPM.
[ 44.504778] usb 4-3: New USB device found, idVendor=346d, idProduct=5678, bcdDevice= 2.00
[ 44.504780] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 44.504781] usb 4-3: Product: Intenso Speed Line
[ 44.504781] usb 4-3: Manufacturer: Intenso
[ 44.504782] usb 4-3: SerialNumber: F...
[ 44.505724] usb-storage 4-3:1.0: USB Mass Storage device detected
[ 44.505850] scsi host8: usb-storage 4-3:1.0
[ 45.553646] scsi 8:0:0:0: Direct-Access Intenso Speed Line 2.00 PQ: 0 ANSI: 4
[ 45.553760] sd 8:0:0:0: Attached scsi generic sg5 type 0
[ 45.554488] sd 8:0:0:0: [sdf] 61440000 512-byte logical blocks: (31.5 GB/29.3 GiB)
[ 45.554656] sd 8:0:0:0: [sdf] Write Protect is off
[ 45.554658] sd 8:0:0:0: [sdf] Mode Sense: 03 00 00 00
[ 45.554768] sd 8:0:0:0: [sdf] No Caching mode page found
[ 45.554769] sd 8:0:0:0: [sdf] Assuming drive cache: write through
[ 45.562434] sdf: sdf1
[ 45.562664] sd 8:0:0:0: [sdf] Attached SCSI removable disk |
These bold lines are different between hosts. On the second host I have "ehci-pci" and no line about LPM. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2452
|
Posted: Sat Aug 31, 2024 1:04 pm Post subject: |
|
|
Do you use a custom or a distribution kernel? If it's custom, try with gentoo-kernel-bin. If it works, the problem is in your custom kernel configuration.
Best Regards,
Georgi |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Sat Aug 31, 2024 1:21 pm Post subject: |
|
|
I use the kernel from gentoo-sources.
I tried my old arch live usb, Arch Linux 5.18-16, kernel 5.18.16-arch1-1 and it also corrupts files on ext4 on the same pendrive. In my opinion, it's even worse on arch, because not a single file was correct, Maybe it's just a coincidence.
Later I can try the latest version of ubuntu live usb. I'll let you know the result later. |
|
Back to top |
|
|
dmpogo Advocate
Joined: 02 Sep 2004 Posts: 3437 Location: Canada
|
Posted: Sat Aug 31, 2024 3:52 pm Post subject: |
|
|
nxe9 wrote: | I don't quite understand what the significance of this is since ntfs works fine on all systems.
I can say that both the "native support" and "FUSE" options are activated in my kernel according to https://wiki.gentoo.org/wiki/NTFS. Also the ntfs3g package is installed on both systems.
dmesg, nothing about ntfs:
Quote: | [ 44.491454] usb 4-3: new SuperSpeed USB device number 2 using xhci_hcd
[ 44.503988] usb 4-3: LPM exit latency is zeroed, disabling LPM.
[ 44.504778] usb 4-3: New USB device found, idVendor=346d, idProduct=5678, bcdDevice= 2.00
[ 44.504780] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 44.504781] usb 4-3: Product: Intenso Speed Line
[ 44.504781] usb 4-3: Manufacturer: Intenso
[ 44.504782] usb 4-3: SerialNumber: F...
[ 44.505724] usb-storage 4-3:1.0: USB Mass Storage device detected
[ 44.505850] scsi host8: usb-storage 4-3:1.0
[ 45.553646] scsi 8:0:0:0: Direct-Access Intenso Speed Line 2.00 PQ: 0 ANSI: 4
[ 45.553760] sd 8:0:0:0: Attached scsi generic sg5 type 0
[ 45.554488] sd 8:0:0:0: [sdf] 61440000 512-byte logical blocks: (31.5 GB/29.3 GiB)
[ 45.554656] sd 8:0:0:0: [sdf] Write Protect is off
[ 45.554658] sd 8:0:0:0: [sdf] Mode Sense: 03 00 00 00
[ 45.554768] sd 8:0:0:0: [sdf] No Caching mode page found
[ 45.554769] sd 8:0:0:0: [sdf] Assuming drive cache: write through
[ 45.562434] sdf: sdf1
[ 45.562664] sd 8:0:0:0: [sdf] Attached SCSI removable disk |
These bold lines are different between hosts. On the second host I have "ehci-pci" and no line about LPM. |
No significance. it was just a remark on a remark that ntfs is probably user space. ntfs related messages will appear only when you mount the drive. Before mount nobody knows about filesystem on the disk |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1266 Location: Richmond Hill, Canada
|
Posted: Sat Aug 31, 2024 5:01 pm Post subject: |
|
|
nxe9,
It seems strange that sometime you pendrive report using "ehci-pci" which is USB2 related then sometime it show as :SuperSpeed USB device using xhci_hcd" wich is USB3 related.
can you do a lsusb -t when your pendrive plug in to "blue" port? I wan to see under USB3 which usb mas storage driver used. I suspect it is the "uas" driver under USB3 causing problem.
the idVendor=346d, idProduct=5678 search on internet is all over place, some report USB2, some report USB3 so I am not sure how to identify this. but hopefully it will be clear that under fixed condition on your machine we will know how kernel identify it.
the "LPM exit latency is zeroed, disabling LPM" is kernel saying it CANNOT manage power for the pandrive
xHCI hardware link PM wrote: | xHCI host controller provides hardware link power management to usb2.0 (xHCI 1.0 feature) and usb3.0 devices which support link PM. By enabling hardware LPM, the host can automatically put the device into lower power state(L1 for usb2.0 devices, or U1/U2 for usb3.0 devices), which state device can enter and resume very quickly.
The user interface for controlling hardware LPM is located in the power/ subdirectory of each USB device’s sysfs directory, that is, in /sys/bus/usb/devices/.../power/ where “...” is the device’s ID. The relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm.
power/usb2_hardware_lpm
When a USB2 device which support LPM is plugged to a xHCI host root hub which support software LPM, the host will run a software LPM test for it; if the device enters L1 state and resume successfully and the host supports USB2 hardware LPM, this file will show up and driver will enable hardware LPM for the device. You can write y/Y/1 or n/N/0 to the file to enable/disable USB2 hardware LPM manually. This is for test purpose mainly.
power/usb3_hardware_lpm_u1 power/usb3_hardware_lpm_u2
When a USB 3.0 lpm-capable device is plugged in to a xHCI host which supports link PM, it will check if U1 and U2 exit latencies have been set in the BOS descriptor; if the check is passed and the host supports USB3 hardware LPM, USB3 hardware LPM will be enabled for the device and these files will be created. The files hold a string value (enable or disable) indicating whether or not USB3 hardware LPM U1 or U2 is enabled for the device. |
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54584 Location: 56N 3W
|
Posted: Sat Aug 31, 2024 5:51 pm Post subject: |
|
|
I suspect the Windows/Linux difference is Windows knows that UAS is broken, so only ever users 'bulk mode' for USB3 but Linux does not.
It uses UAS by default but it fails.
Disable UAS for your vendor and Device ID to test. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Sat Aug 31, 2024 7:34 pm Post subject: |
|
|
dmpogo wrote: | Before mount nobody knows about filesystem on the disk |
Yes, I think so too. However, there was no additional information about ntfs when mounting. Now I have ext4, so I won't say, but if it's important, I can check it again.
pingtoo wrote: | It seems strange that sometime you pendrive report using "ehci-pci" which is USB2 related then sometime it show as :SuperSpeed USB device using xhci_hcd" wich is USB3 related. |
It probably depends on the host I'm operating on. It's not random. Take into account that we are talking about two computers on which I am testing. So I will be more specific in the future. Let me sum it up again.
Host 1 (PC), it has two black slots, multiple blue slots:
- ext4, gentoo - negative
- ntfs, gentoo - I don't remember if I tested it.
- ntfs, windows - postive
Host 2 (Laptop), it has one yellow slot and two blue slots:
- ext4, gentoo - negative
- ext4, arch live usb - negative
- ext4, ubuntu 24.04.1 live usb - negative <- I did this test today.
- ntfs, gentoo - positive
The result of "lsusb -t" on Host 2, pendrive inside blue slot:
Code: | lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/8p, 480M
|__ Port 002: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 002: Dev 003, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 004: Dev 005, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 002: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 004: Dev 004, If 0, Class=Wireless, Driver=[none], 12M
|__ Port 004: Dev 004, If 1, Class=Wireless, Driver=[none], 12M
|__ Port 005: Dev 005, If 0, Class=Video, Driver=[none], 480M
|__ Port 005: Dev 005, If 1, Class=Video, Driver=[none], 480M |
I checked the kernel config on Host 2 and
Code: | <> xHCI HCD (USB 3.0) support |
xHCI is not activated. That is the reason I see only ehci-pci in the logs on my laptop. Good to know, I will have to activate USB 3.0 in the future, but that's a different topic.
Edit: I activated xHCI in the kernel on Host 2.
Code: | lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 480M
|__ Port 002: Dev 002, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 002: Dev 002, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 003.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 002: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 004: Dev 004, If 0, Class=Wireless, Driver=[none], 12M
|__ Port 004: Dev 004, If 1, Class=Wireless, Driver=[none], 12M
|__ Port 005: Dev 005, If 0, Class=Video, Driver=[none], 480M
|__ Port 005: Dev 005, If 1, Class=Video, Driver=[none], 480M
/: Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 004: Dev 002, If 0, Class=Mass Storage, Driver=usb-storage, 5000M |
NeddySeagoon wrote: | Disable UAS for your vendor and Device ID to test. |
Thanks for the information. I'll try, but I'll have to familiarize myself with the topic first. At the moment I don't know how. If anyone has any guidance for me I will be grateful.
Edit:
@NeddySeagoon:
The driver seems to be usb-storage not uas, see the lsusb log. What do you think about this? |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1266 Location: Richmond Hill, Canada
|
Posted: Sat Aug 31, 2024 8:02 pm Post subject: |
|
|
nxe9,
Quote: | Code: |
|__ Port 004: Dev 005, If 0, Class=Mass Storage, Driver=usb-storage, 480M |
|
So this is indicate using "usb-storage" driver. The "480M" indicate it is USB2 max speed.
Since your Host 2 (laptop) does not have USB3 build in kernel and you pendrive is actually a USB3 device (This part is assumption) for some "unknown" reason at this moment, ext4 always having problem, whereas ntfs does not.
hmm, so ext4+usb-storage+usb2 mode bad
and ntfs+usb-storage+usb2 mode good
I am not sure what to do here. I see no reason for the ext4+usb-storage+usb2 is bad combo. I am going back to the guess about block size difference between ext4 and ntfs. may be some one can chip in about test with different ext4 block size?
I don't know if pendrive have concept of sector. and if sector size matter. (I know it matter in term for file system formatting. I am just not if it matter here) |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Sat Aug 31, 2024 8:13 pm Post subject: |
|
|
@pingtoo:
Did you see my changes in the last post?
ext4+usb-storage+usb2 seems to be bad
ext4+usb-storage+usb3 seems to be bad (not tested on laptop yet but I believe this is the config on my pc).
UAS was not activated in the kernel. I activated UAS and this is the new output (Host 2 - laptop)
Code: | lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 480M
|__ Port 002: Dev 002, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 002: Dev 002, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 003.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
|__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 002: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 004: Dev 004, If 0, Class=Wireless, Driver=[none], 12M
|__ Port 004: Dev 004, If 1, Class=Wireless, Driver=[none], 12M
|__ Port 005: Dev 005, If 0, Class=Video, Driver=[none], 480M
|__ Port 005: Dev 005, If 1, Class=Video, Driver=[none], 480M
/: Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 004: Dev 002, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
|
Driver is still usb-storage. So, I don't think the pendrive supports uas. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1266 Location: Richmond Hill, Canada
|
Posted: Sat Aug 31, 2024 8:48 pm Post subject: |
|
|
nxe9,
I just look you update, now it is USB3 mode.
I wonder.
I wonder, if the pendrive need to force on uas, I thought uas is default mode for USB3. may be our guess is upside down. may be it need uas and it is not getting it?
I will do some research. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54584 Location: 56N 3W
|
Posted: Sat Aug 31, 2024 9:20 pm Post subject: |
|
|
See https://wiki.gentoo.org/wiki/Raspberry_Pi_Install_Guide#Unreliable_USB_Attached_SCSI for disabling UAS.
The method is general, no just for Raspberry Pi.
You must use the Vendor and Device IDs of your USB stick, not the ones giver there. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1266 Location: Richmond Hill, Canada
|
Posted: Sat Aug 31, 2024 9:36 pm Post subject: |
|
|
nxe9,
I check hardware for linux, it show the 346d:5678 should be able use uas and usb-storage. and I check linux mainline, 346d:5678 is not known. (can find reference in source code)
so if your kernel have CONFIG_USB_UAS=m? may be you need to load the module before plug in? |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Sat Aug 31, 2024 10:04 pm Post subject: |
|
|
@NeddySeagoon:
The UAS option was not activated in the kernel at all. After activating the UAS driver, it is not loaded as seen in the log above. So I guess the problem isn't that UAS breaks something. Unless I don't understand something.
@pingtoo:
CONFIG_USB_UAS=y is my current config.
I tested data transfer again on my laptop, this time on xhci_hcd (usb 3), both ntfs and ext4. The result is the same. Ntfs works fine and ext4 still corrupts data. I noticed one more thing. ntfs runs extremely fast. In turn, on ext4, data is copied very quickly to a size of about 2 GB. After that, the transfer slows down extremely. Copying several GB takes many minutes. There is no such problem on ntfs.
Edit:
One more thing, when copying to ext4, this information appears in dmesg, as far as I remember, it didn't appear on USB 2.
Code: | [ 6915.810378] usb 4-4: reset SuperSpeed USB device number 2 using xhci_hcd
[ 6916.655956] usb 4-4: LPM exit latency is zeroed, disabling LPM.
[ 6950.626486] usb 4-4: reset SuperSpeed USB device number 2 using xhci_hcd
[ 6952.993540] usb 4-4: LPM exit latency is zeroed, disabling LPM.
[ 7100.131424] usb 4-4: reset SuperSpeed USB device number 2 using xhci_hcd
[ 7102.073934] usb 4-4: LPM exit latency is zeroed, disabling LPM.
[ 7133.922475] usb 4-4: reset SuperSpeed USB device number 2 using xhci_hcd
[ 7134.901196] usb 4-4: LPM exit latency is zeroed, disabling LPM.
|
Edit2:
Code: | time cp myfiles/* /mnt/usb/ |
ext4:
ntfs:
Edit3:
On Ubuntu live usb, there is also only usb-storage, no uas according to "lsusb -t". |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54584 Location: 56N 3W
|
Posted: Mon Sep 02, 2024 11:44 am Post subject: |
|
|
nxe9,
Lets do a sanity check on your times.
A USB 3 interface operates at at theoretical 5000 Gbits/sec.
Say 600Mbytes/sec. there is overhead too, so user data cannot get all the bandwidth.
All the data could pass over the interface in your reported NTFS time.
Good but that's the easy bit.
The FLASH memory cannot write it at anything like that speed.
We need to ask if your memory stick supports discard.
If not, you need to wait for very slow FLASH erase cycles.
FLASH cannot just be overwritten like a HDD.
What does fstrim -v /USB fs mount point tell?
The NTFS time looks too good to be true, so it probably is.
The ext4 time indicates that something is wrong.
Lots of USB bus resets in dmesg?
The reason discard matters, is that mkfs will do discard if its supported, so that the FLASH starts out erased, all ready for writes.
No slow erase cycles required until the fs has been filled once. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Mon Sep 02, 2024 5:53 pm Post subject: |
|
|
@NeddySeagoon: However, I didn't say anything about the size of my source (myfiles/*). It was rather little data. There it was just about showing the proportion in the time difference.
NeddySeagoon wrote: | What does fstrim -v /USB fs mount point tell? |
Code: | fstrim -v /mnt/usb/
fstrim: /mnt/usb/: the discard operation is not supported
|
/mnt/usb/ is my ext4 mount point.
I did more speed tests. This time my input contains 24G.
1. disk zeroing
Code: | time (cat /dev/zero > /dev/sdb)
cat: write error: No space left on device
real 15m14.308s
user 0m0.132s
sys 0m41.732s
|
2. creating 1 ntfs partition
3. write and read on ntfs
Code: | time mount /dev/sdb1 /mnt/usb/ && time cp mynewinput/* /mnt/usb/ && time umount /mnt/usb/ && time mount /dev/sdb1 /mnt/usb/ && time crc32 /mnt/usb/* && time umount /mnt/usb/ |
Code: | real 0m0.061s
user 0m0.002s
sys 0m0.011s
real 11m13.120s
user 0m0.595s
sys 1m18.759s
real 1m17.049s
user 0m0.001s
sys 0m2.718s
real 0m0.058s
user 0m0.001s
sys 0m0.010s
//crc32 output... OK
real 3m50.419s
user 1m1.050s
sys 0m19.721s
real 0m1.938s
user 0m0.001s
sys 0m1.917s
|
4. disk zeroing
Code: | time (cat /dev/zero > /dev/sdb)
cat: write error: No space left on device
real 15m17.137s
user 0m0.286s
sys 0m40.345s
|
5. creating 1 ext4 partition
6. write and read on ext4
Code: | time mount /dev/sdb1 /mnt/usb/ && time cp mynewinput/* /mnt/usb/ && time umount /mnt/usb/ && time mount /dev/sdb1 /mnt/usb/ && time crc32 /mnt/usb/* && time umount /mnt/usb/ |
Still in progress. I can clearly see that this is taking a long time. I think a ratio of 1 to 12, as before, will be realistic here. Copying to ext4 therefore takes 12 times longer than to ntfs and ends with data corruption.
Last edited by nxe9 on Mon Sep 02, 2024 5:59 pm; edited 1 time in total |
|
Back to top |
|
|
dmpogo Advocate
Joined: 02 Sep 2004 Posts: 3437 Location: Canada
|
Posted: Mon Sep 02, 2024 5:58 pm Post subject: |
|
|
What about any other filesystem on the pendrive ? VFAT ? xfs ? Do they work ? |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Mon Sep 02, 2024 5:59 pm Post subject: |
|
|
@dmpogo:
Good question. I'll test it later and let you know. |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Mon Sep 02, 2024 8:57 pm Post subject: |
|
|
Ntfs vs ext4, 24G of data
Code: | time mount /dev/sdb1 /mnt/usb/ && time cp mynewinput/* /mnt/usb/ && time umount /mnt/usb/ && time mount /dev/sdb1 /mnt/usb/ && time crc32 /mnt/usb/* && time umount /mnt/usb/ |
Ntfs
Code: | real 0m0.061s
user 0m0.002s
sys 0m0.011s
real 11m13.120s
user 0m0.595s
sys 1m18.759s
real 1m17.049s
user 0m0.001s
sys 0m2.718s
real 0m0.058s
user 0m0.001s
sys 0m0.010s
//crc32 output... OK
real 3m50.419s
user 1m1.050s
sys 0m19.721s
real 0m1.938s
user 0m0.001s
sys 0m1.917s |
ext4
Code: | real 0m0.055s
user 0m0.000s
sys 0m0.007s
real 120m4.123s
user 0m0.471s
sys 0m54.700s
real 3m30.774s
user 0m0.000s
sys 0m1.375s
real 0m0.056s
user 0m0.001s
sys 0m0.006s
//crc32 output... BAD 7 of 13 files.
real 10m46.686s
user 1m1.192s
sys 0m28.895s
real 0m1.377s
user 0m0.000s
sys 0m1.299s |
Just as I suspected, ext4 is about >10 times slower than ntfs with this pendrive.
Edit:
I tested exFAT. It takes long time but it doesn't corrupt files.
Code: | real 0m0.128s
user 0m0.001s
sys 0m0.010s
real 127m15.930s
user 0m0.371s
sys 1m12.623s
real 1m33.662s
user 0m0.001s
sys 0m2.893s
real 0m0.144s
user 0m0.003s
sys 0m0.007s
//crc32 output... OK
real 3m49.422s
user 0m59.774s
sys 0m23.114s
real 0m1.284s
user 0m0.001s
sys 0m1.270s |
This is all strange. |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2181
|
Posted: Tue Sep 03, 2024 9:34 am Post subject: |
|
|
I think totally irrelevant, but it might be fun (for certain values of "fun") to try this with F2FS. _________________ Greybeard |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Tue Sep 03, 2024 12:54 pm Post subject: |
|
|
@Goverp: I will test it today. Another interesting thing, I will check whether ext4 generates the same errors every time or maybe checksums are random. Although I had the impression that it was random, but I need to verify it. |
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Wed Sep 04, 2024 6:41 pm Post subject: |
|
|
I have some news. Ext4 corrupts data „randomly“. The second time I managed to observe that the entire ext4 file system was corrupted. When copying to f2fs the file system also crashed. I am providing some logs below. Ntfs still works flawlessly and very quickly every time.
I will summarize all my observations:
- Ext4 corrupts data every time, or sometimes the entire file system corrupts. This was tested on several Linux distributions and on two machines. Moreover, copying data to ext4 takes a very long time.
- Ntfs worked correctly and quickly every time on both Linux and Windows.
- With f2fs the entire file system broke (only one test).
- exFat worked correctly but very slowly (only one test).
- The problem with ext4 occurs also on my second pendrive on exactly the same model. However, on a model from the same series, but of a different size, the problem does not occur.
- These two series have different idVendor and idProduct.
Models that cause the problem:
Intenso Speed Line, idVendor=346d, idProduct=5678, 31.5 GB/29.3GiB
A model that works well:
Intenso Speed Line, idVendor=1f75, idProduct=0903, 126 GB/117GiB
What could be causing the problems? Perhaps some bug in the system's file implementation or a hardware bug that cannot be detected by other file systems. This is just speculation.
What further options do I have? I think that either contact the manufacturer or report the bug on the kernel mailing list in the hope that some developer will be willing to debug it. I don't know when I will do it, because I treat it as a curiosity and this problem is not a high priority for me.
Thank you for your help, and if anyone has any other ideas, I can try.
I will just add that the errors below are not the same as the situation when files contain incorrect data in the case of ext4. In such a situation, there are no logs in dmesg. However, here all the copying went wrong and was interrupted.
f2fs error while copying
Code: | [ 2501.346197] usb 2-2: reset high-speed USB device number 2 using xhci_hcd
[ 2502.192418] usb 2-2: device firmware changed
[ 2502.192535] usb 2-2: USB disconnect, device number 2
[ 2502.199844] device offline error, dev sdb, sector 53389056 op 0x1:(WRITE) flags 0x104000 phys_seg 23 prio class 2
[ 2502.199865] device offline error, dev sdb, sector 53389296 op 0x1:(WRITE) flags 0x100000 phys_seg 2 prio class 2
[ 2502.200137] device offline error, dev sdb, sector 53405696 op 0x1:(WRITE) flags 0x104000 phys_seg 12 prio class 2
[ 2502.200147] device offline error, dev sdb, sector 53405936 op 0x1:(WRITE) flags 0x104000 phys_seg 9 prio class 2
[ 2502.200159] device offline error, dev sdb, sector 53406176 op 0x1:(WRITE) flags 0x104000 phys_seg 5 prio class 2
[ 2502.200165] device offline error, dev sdb, sector 53406416 op 0x1:(WRITE) flags 0x104000 phys_seg 5 prio class 2
[ 2502.200175] device offline error, dev sdb, sector 53406656 op 0x1:(WRITE) flags 0x104000 phys_seg 5 prio class 2
[ 2502.200181] device offline error, dev sdb, sector 53406896 op 0x1:(WRITE) flags 0x104000 phys_seg 4 prio class 2
[ 2502.200198] device offline error, dev sdb, sector 53407136 op 0x1:(WRITE) flags 0x104000 phys_seg 4 prio class 2
[ 2502.200202] device offline error, dev sdb, sector 53407376 op 0x1:(WRITE) flags 0x104000 phys_seg 3 prio class 2
[ 2502.801197] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801205] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801207] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801208] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801210] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801211] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801212] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801213] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801215] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801216] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801217] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801219] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801220] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801222] F2FS-fs (sdb1): Stopped filesystem due to reason: 3
[ 2502.801241] Buffer I/O error on dev sdb1, logical block 1, lost sync page write
[ 2502.801247] F2FS-fs (sdb1): f2fs_commit_super fails to record err:-5
[ 2504.082873] usb 2-2: new high-speed USB device number 3 using xhci_hcd
[ 2504.210489] usb 2-2: New USB device found, idVendor=ffff, idProduct=5678, bcdDevice= 2.00
[ 2504.210500] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2504.210504] usb 2-2: Product: 䍆㈳㔶
[ 2504.210507] usb 2-2: Manufacturer: 楆獲t档灩
[ 2504.210511] usb 2-2: SerialNumber: 012345678901
[ 2504.211647] usb-storage 2-2:1.0: USB Mass Storage device detected
[ 2504.211920] scsi host7: usb-storage 2-2:1.0
[ 2525.922190] usb 2-2: reset high-speed USB device number 3 using xhci_hcd |
ext4 error while copying
Code: | cp: error writing '<replaced...>': Input/output error
cp: cannot create regular file '<replaced...>': Read-only file system
cp: cannot create regular file '<replaced...>': Read-only file system
cp: cannot create regular file '<replaced...>': Read-only file system
...
[ 8202.825924] EXT4-fs (sdb1): mounted filesystem 84c42b25-807a-494f-a8de-bbb280c21d38 r/w with ordered data mode. Quota mode: none.
[ 8207.481253] EXT4-fs error (device sdb1): ext4_validate_block_bitmap:421: comm ext4lazyinit: bg 176: bad block bitmap checksum
[ 8228.651866] EXT4-fs (sdb1): unmounting filesystem 84c42b25-807a-494f-a8de-bbb280c21d38.
[ 8237.434827] EXT4-fs (sdb1): warning: mounting fs with errors, running e2fsck is recommended
[ 8237.435636] EXT4-fs (sdb1): mounted filesystem 84c42b25-807a-494f-a8de-bbb280c21d38 r/w with ordered data mode. Quota mode: none.
[ 8238.993344] EXT4-fs error (device sdb1): ext4_validate_block_bitmap:421: comm ext4lazyinit: bg 176: bad block bitmap checksum
...
[ 8557.663116] EXT4-fs (sdb1): error count since last fsck: 3
[ 8557.663137] EXT4-fs (sdb1): initial error at time 1725382598: ext4_validate_block_bitmap:421
[ 8557.663148] EXT4-fs (sdb1): last error at time 1725383358: ext4_validate_block_bitmap:421
...
[11843.298598] usb 2-2: reset high-speed USB device number 2 using xhci_hcd
[11844.103802] usb 2-2: device firmware changed
[11844.103922] usb 2-2: USB disconnect, device number 2
[11844.111282] device offline error, dev sdb, sector 60278752 op 0x1:(WRITE) flags 0x0 phys_seg 1 prio class 2
[11844.111301] EXT4-fs warning (device sdb1): ext4_end_bio:343: I/O error 17 writing to inode 20 starting block 7534844)
[11844.111331] device offline error, dev sdb, sector 60286976 op 0x1:(WRITE) flags 0x4000 phys_seg 2 prio class 2
[11844.111377] device offline error, dev sdb, sector 60287216 op 0x1:(WRITE) flags 0x4000 phys_seg 2 prio class 2
[11844.111399] device offline error, dev sdb, sector 60287456 op 0x1:(WRITE) flags 0x4000 phys_seg 3 prio class 2
[11844.111425] device offline error, dev sdb, sector 60287696 op 0x1:(WRITE) flags 0x4000 phys_seg 2 prio class 2
[11844.111434] device offline error, dev sdb, sector 60287936 op 0x1:(WRITE) flags 0x4000 phys_seg 3 prio class 2
[11844.111450] device offline error, dev sdb, sector 60288176 op 0x1:(WRITE) flags 0x4000 phys_seg 2 prio class 2
[11844.111460] device offline error, dev sdb, sector 29749456 op 0x1:(WRITE) flags 0x9800 phys_seg 10 prio class 2
[11844.111492] device offline error, dev sdb, sector 60288416 op 0x1:(WRITE) flags 0x4000 phys_seg 3 prio class 2
[11844.111504] Aborting journal on device sdb1-8.
[11844.111509] device offline error, dev sdb, sector 60288656 op 0x1:(WRITE) flags 0x4000 phys_seg 2 prio class 2
[11844.111522] Buffer I/O error on dev sdb1, logical block 3702784, lost sync page write
[11844.111521] EXT4-fs error (device sdb1) in ext4_reserve_inode_write:5787: Journal has aborted
[11844.111523] EXT4-fs error (device sdb1) in ext4_reserve_inode_write:5787: Journal has aborted
[11844.111534] EXT4-fs error (device sdb1): ext4_convert_unwritten_extents:4849: inode #20: comm kworker/u16:2: mark_inode_dirty error
[11844.111539] EXT4-fs error (device sdb1): ext4_dirty_inode:5991: inode #21: comm cp: mark_inode_dirty error
[11844.111543] JBD2: I/O error when updating journal superblock for sdb1-8.
[11844.111545] EXT4-fs error (device sdb1) in ext4_convert_unwritten_io_end_vec:4888: Journal has aborted
[11844.111551] EXT4-fs error (device sdb1) in ext4_dirty_inode:5992: Journal has aborted
[11844.111553] EXT4-fs (sdb1): failed to convert unwritten extents to written extents -- potential data loss! (inode 20, error -30)
[11844.111565] Buffer I/O error on device sdb1, logical block 7533568
[11844.111574] Buffer I/O error on device sdb1, logical block 7533569
[11844.111577] Buffer I/O error on device sdb1, logical block 7533570
[11844.111580] Buffer I/O error on device sdb1, logical block 7533571
[11844.111583] Buffer I/O error on device sdb1, logical block 7533572
[11844.111586] Buffer I/O error on device sdb1, logical block 7533573
[11844.111588] Buffer I/O error on device sdb1, logical block 7533574
[11844.111591] Buffer I/O error on device sdb1, logical block 7533575
[11844.111594] Buffer I/O error on device sdb1, logical block 7533576
[11844.111596] Buffer I/O error on device sdb1, logical block 7533577
[11844.111757] EXT4-fs error (device sdb1): ext4_journal_check_start:84: comm kworker/u16:1: Detected aborted journal
[11844.111788] EXT4-fs warning (device sdb1): ext4_end_bio:343: I/O error 17 writing to inode 21 starting block 7536892)
[11844.111807] Buffer I/O error on dev sdb1, logical block 0, lost sync page write
[11844.111816] EXT4-fs (sdb1): I/O error while writing superblock
[11844.111819] EXT4-fs (sdb1): Remounting filesystem read-only
[11844.111822] EXT4-fs (sdb1): ext4_do_writepages: jbd2_start: 1024 pages, ino 13; err -30
[11844.112653] Buffer I/O error on dev sdb1, logical block 0, lost sync page write
[11844.112670] EXT4-fs (sdb1): I/O error while writing superblock
[11845.532320] usb 2-2: new high-speed USB device number 3 using xhci_hcd
[11845.659894] usb 2-2: New USB device found, idVendor=ffff, idProduct=5678, bcdDevice= 2.00
[11845.659906] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[11845.659910] usb 2-2: Product: 䍆㈳㔶
[11845.659913] usb 2-2: Manufacturer: 楆獲t档灩
[11845.659917] usb 2-2: SerialNumber: 012345678901
[11845.661033] usb-storage 2-2:1.0: USB Mass Storage device detected
[11845.661414] scsi host7: usb-storage 2-2:1.0
[11867.362604] usb 2-2: reset high-speed USB device number 3 using xhci_hcd |
|
|
Back to top |
|
|
nxe9 Tux's lil' helper
Joined: 05 Jun 2021 Posts: 121
|
Posted: Tue Sep 24, 2024 8:00 pm Post subject: |
|
|
I want to update the topic. I reported the bug on kernel bugzilla. They convinced me that it was a hardware problem and I would stick to it from now on.
https://bugzilla.kernel.org/show_bug.cgi?id=219300
Back to the main question, I can answer it myself now. "How to tell for sure that a USB stick is broken?" Based on entries from bugzilla, it is enough that one tool displays an error and it is worth assuming that the device is suitable for trash. In particular, I mean the errors displayed by dmesg during the test.
What tool should we use to detect errors when we want to check the device? My experience shows that there is no single such tool. The best method is therefore to perform different tests, using different methods. I can add that in the case of raw hardware without a file system, I had no luck with badblock, while "f3probe --destructive --time-ops /dev/sdb" regularly produced errors. I only discovered this today. As already mentioned, it is worth performing all the tests discussed in [1] and in the event of the first error, throw the disk into the trash bin.
[1] https://www.cyberciti.biz/faq/linux-check-the-physical-health-of-a-usb-stick-flash-drive/
And most importantly, do not buy cheap, unreputable drives to protect your data.
Thank you all for your help. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2452
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|