将文件复制到 Ubuntu 计算机上的网络共享时查找文件损坏的原因

将文件复制到 Ubuntu 计算机上的网络共享时查找文件损坏的原因

我正在使用网络驱动器通过 Windows 7 将文件从 SD 卡复制到 Ubuntu 服务器。

问题是有时 150 个文件中有 2 个在传输过程中损坏。

请参阅此处的 2 个十六进制示例文件比较,左侧为原始文件,右侧为如何存储在服务器上。它们相差约 10kB。在第二个示例中,您可以看到添加了 00。

文件 1 - .JPG 示例

文件 2 - .CR2 示例

我不知道是什么原因造成的。所以我请求任何建议如何缩小可能的错误源。

我认为这不是硬件本身的问题,因为有 2 个驱动器受到影响。

网络连接也不是问题,这是由电缆限制引起的,我从来没有遇到过这种问题。

我妻子感觉有时在 Picasa 中处理文件时也会出现该错误。但我不能肯定地说。

我的猜测是,这是 ext4 fs 或 samba 或 mount 上的某种竞争条件错误。

这里有一些系统信息,可能会有所帮助:

受影响的驱动器是:

UUID="bc57f0fd-c16d-450e-83aa-4b7faace655c" /media/FOTOS2/ ext4 defaults 2
UUID="aacc7c57-8997-42c3-a2fc-648fe5a9009c" /media/WDRED2TB/ ext4 defaults 2

这是完整的 fstab 文件:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=9978d40a-b90d-49e1-ab7a-002cc0577120 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=AA12-9F54  /boot/efi       vfat    defaults        0       1
# swap was on /dev/sda3 during installation
UUID=bba8a1b5-a7da-44a2-a220-23a69c73e6ab none            swap    sw              0       0


UUID="bc57f0fd-c16d-450e-83aa-4b7faace655c" /media/FOTOS2/ ext4 defaults 2
UUID="aacc7c57-8997-42c3-a2fc-648fe5a9009c" /media/WDRED2TB/ ext4 defaults 2
UUID="ba87bd76-a34a-45a5-8268-4de331ebf72f" /media/RAID/ ext4 defaults 0 2

这里是“mount”输出

/dev/sde2 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /sys/firmware/efi/efivars type efivarfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sde1 on /boot/efi type vfat (rw)
/dev/sdc1 on /media/FOTOS2 type ext4 (rw)
/dev/sdb1 on /media/WDRED2TB type ext4 (rw)
/dev/md0p1 on /media/RAID type ext4 (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=piotre)

该系统是一个

piotre@SERVER:~$ uname -a
Linux SERVER 3.13.0-46-generic #79-Ubuntu SMP Tue Mar 10 20:06:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

dumpe2fs 给出了其中一个驱动器的信息:

Filesystem volume name:   WDRED2TB
Last mounted on:          /media/WDRED2TB
Filesystem UUID:          aacc7c57-8997-42c3-a2fc-648fe5a9009c
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              122101760
Block count:              488378385
Reserved block count:     24418919
Free blocks:              36947951
Free inodes:              121834982
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      907
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
RAID stride:              1
Flex block group size:    16
Filesystem created:       Wed May  1 12:47:05 2013
Last mount time:          Tue Apr  7 15:27:31 2015
Last write time:          Tue Apr  7 15:27:31 2015
Mount count:              169
Maximum mount count:      25
Last checked:             Mon Jul 21 21:11:14 2014
Check interval:           15552000 (6 months)
Next check after:         Sat Jan 17 20:11:14 2015
Lifetime writes:          2513 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      9e898ed8-9275-4e6f-9dd6-431190f4b932
Journal backup:           inode blocks
Jounaleigenschaften:         journal_incompat_revoke
Journalgrösse:            128M
Journal-Länge:            32768
Journal-Sequenz:          0x00028de6
Journal-Start:            1

首先我尝试修改 smb.conf (始终同步和严格同步),但没有帮助。这里是当前的 smb.conf

[global]
workgroup=WORKGROUP
server string=%h server (Samba, Ubuntu)
netbios name=SERVER
dns proxy=no
log file=/var/log/samba/log.%m
max log size=1000
syslog=0
panic action=/usr/share/samba/panic-action %d
server role=standalone server
map to guest=bad user
usershare allow guests=yes
security=share
force user=nobody
guest account=nobody
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
strict syn = yes
sync always = yes

答案1

我不确定您是否已经弄清楚了,但您在 smb.conf 中拼错了“严格同步”(忘记了“c”)。此外,如果未启用严格同步,“始终同步”将不起作用(在这种情况下,由于错误而不会启用)。

相关内容