Ich habe eine externe Festplatte an einen ASUS-Router angeschlossen, der einen Samba-Server implementiert. Alles funktioniert einwandfrei, bis auf eine nervige Sache: Das Erstellen eines Verzeichnisses mit mkdir gibt eine Fehlermeldung zurück, obwohl das Verzeichnis tatsächlich erstellt wurde.
Die entsprechende Zeile in /etc/fstab
sieht folgendermaßen aus:
//192.168.1.1/data /media/external/data cifs username=data,password=data,vers=2.0,uid=1000,gid=1000 0 0
Beim Einhängen der Festplatte ist alles in Ordnung. (Das Verzeichnis stackoverflow
befindet sich auf der externen Festplatte.)
daniel@nuc:/media/external$ ll
total 12
drwxr-xr-x 5 root root 4096 mar 23 21:05 ./
drwxr-xr-x 4 root root 4096 mar 10 15:25 ../
drwxr-xr-x 2 daniel daniel 4096 mar 24 10:50 data/
daniel@nuc:/media/external$ sudo mount -a
daniel@nuc:/media/external$ cd data
daniel@nuc:/media/external/data$ ll
total 4
drwxr-xr-x 2 daniel daniel 0 mar 24 10:54 ./
drwxr-xr-x 5 root root 4096 mar 23 21:05 ../
drwxr-xr-x 2 daniel daniel 0 mar 14 23:07 stackoverflow/
daniel@nuc:/media/external/data$
Beim Erstellen des Verzeichnisses test
wird eine Fehlermeldung angezeigt.
daniel@nuc:/media/external/data$ mkdir test
mkdir: cannot create directory ‘test’: Not a directory
Das Verzeichnis wird jedoch erstellt!
daniel@nuc:/media/external/data$ ll
total 4
drwxr-xr-x 2 daniel daniel 0 mar 24 11:01 ./
drwxr-xr-x 5 root root 4096 mar 23 21:05 ../
drwxr-xr-x 2 daniel daniel 0 mar 14 23:07 stackoverflow/
drwxr-xr-x 2 daniel daniel 0 mar 24 11:01 test/
Wenn Sie das Verzeichnis entfernen und es mit dem -p
Flag neu erstellen, wird die Fehlermeldung nicht angezeigt.
daniel@nuc:/media/external/data$ rmdir test
daniel@nuc:/media/external/data$ ll
total 4
drwxr-xr-x 2 daniel daniel 0 mar 24 11:01 ./
drwxr-xr-x 5 root root 4096 mar 23 21:05 ../
drwxr-xr-x 2 daniel daniel 0 mar 14 23:07 stackoverflow/
daniel@nuc:/media/external/data$ mkdir -p test
daniel@nuc:/media/external/data$ ll
total 4
drwxr-xr-x 2 daniel daniel 0 mar 24 11:01 ./
drwxr-xr-x 5 root root 4096 mar 23 21:05 ../
drwxr-xr-x 2 daniel daniel 0 mar 14 23:07 stackoverflow/
drwxr-xr-x 2 daniel daniel 0 mar 24 11:01 test/
daniel@nuc:/media/external/data$
Daher frage ich mich, ob das Problem darin besteht, dass mkdir das gemountete Verzeichnis aus irgendeinem Grund nicht "sieht" und eine Fehlermeldung ausgibt, als ob Sie versuchen würden, ein Unterverzeichnis in einem nicht vorhandenen Verzeichnis zu erstellen.
Aber warum ist das so? Was kann ich tun, um das Problem zu beheben?
(Ich will hinzufügen , dass , wenn es mit Montage vers=1.0
, die mkdir Fehler nicht zeigen. Allerdings file_mode
und dir_mode
dann ignoriert zu sein scheinen, und ich brauche sie eingestellt werden , 0700
in einer anderen Anwendung.)
Update: Wenn der Datenträger an den USB-Anschluss des Computers angeschlossen und NTFS gemountet ist, funktioniert alles einwandfrei.
Update: Ausgabe von strace mkdir test
execve("/bin/mkdir", ["mkdir", "test"], 0x7ffdb3669768 /* 67 vars */) = 0
brk(NULL) = 0x561761838000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=158495, ...}) = 0
mmap(NULL, 158495, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f782b715000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20b\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=154832, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f782b713000
mmap(NULL, 2259152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f782b2ed000
mprotect(0x7f782b312000, 2093056, PROT_NONE) = 0
mmap(0x7f782b511000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7f782b511000
mmap(0x7f782b513000, 6352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f782b513000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0
mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f782aefc000
mprotect(0x7f782b0e3000, 2097152, PROT_NONE) = 0
mmap(0x7f782b2e3000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f782b2e3000
mmap(0x7f782b2e9000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f782b2e9000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=464824, ...}) = 0
mmap(NULL, 2560264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f782ac8a000
mprotect(0x7f782acfa000, 2097152, PROT_NONE) = 0
mmap(0x7f782aefa000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x70000) = 0x7f782aefa000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14560, ...}) = 0
mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f782aa86000
mprotect(0x7f782aa89000, 2093056, PROT_NONE) = 0
mmap(0x7f782ac88000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f782ac88000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000b\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=144976, ...}) = 0
mmap(NULL, 2221184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f782a867000
mprotect(0x7f782a881000, 2093056, PROT_NONE) = 0
mmap(0x7f782aa80000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0x7f782aa80000
mmap(0x7f782aa82000, 13440, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f782aa82000
close(3) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f782b711000
arch_prctl(ARCH_SET_FS, 0x7f782b712040) = 0
mprotect(0x7f782b2e3000, 16384, PROT_READ) = 0
mprotect(0x7f782aa80000, 4096, PROT_READ) = 0
mprotect(0x7f782ac88000, 4096, PROT_READ) = 0
mprotect(0x7f782aefa000, 4096, PROT_READ) = 0
mprotect(0x7f782b511000, 4096, PROT_READ) = 0
mprotect(0x56175ffd9000, 4096, PROT_READ) = 0
mprotect(0x7f782b73c000, 4096, PROT_READ) = 0
munmap(0x7f782b715000, 158495) = 0
set_tid_address(0x7f782b712310) = 7736
set_robust_list(0x7f782b712320, 24) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7f782a86ccb0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f782a879890}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7f782a86cd50, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f782a879890}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/sys/fs/selinux", 0x7fff4f557960) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fff4f557960) = -1 ENOENT (No such file or directory)
brk(NULL) = 0x561761838000
brk(0x561761859000) = 0x561761859000
openat(AT_FDCWD, "/proc/filesystems", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 420
read(3, "", 1024) = 0
close(3) = 0
access("/etc/selinux/config", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=11861168, ...}) = 0
mmap(NULL, 11861168, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7829d17000
close(3) = 0
mkdir("test", 0777) = -1 ENOTDIR (Not a directory)
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2995
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=578, ...}) = 0
mmap(NULL, 578, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f782b73b000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "mkdir: ", 7mkdir: ) = 7
write(2, "cannot create directory \342\200\230test\342"..., 34cannot create directory ‘test’) = 34
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Not a directory", 17: Not a directory) = 17
write(2, "\n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(1) = ?
+++ exited with 1 +++
Update auf Anfrage, die smb.conf
Datei vom ASUS Router (etwas aufgeräumt, relevante Teile behalten):
[global]
workgroup = WORKGROUP
netbios name = RT-AC68U-AC48
server string = RT-AC68U-AC48
unix charset = UTF8
display charset = UTF8
load printers = no
printing = bsd
printcap name = /dev/null
log file = /var/log.samba
log level = 0
max log size = 5
security = USER
guest ok = no
map to guest = Bad User
encrypt passwords = yes
pam password change = no
null passwords = yes
force directory mode = 0777
force create mode = 0777
max connections = 5
socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE
obey pam restrictions = no
disable spoolss = yes
host msdfs = no
strict allocate = no
wide links = no
bind interfaces only = yes
interfaces = lo br0 192.168.1.1/255.255.255.0
use sendfile = yes
map archive = no
map hidden = no
map read only = no
map system = no
store dos attributes = yes
dos filemode = yes
oplocks = yes
level2 oplocks = yes
kernel oplocks = no
enable core files = no
deadtime = 30
load printers = no
printable = no
max protocol = SMB2
min protocol = SMB2
smb encrypt = disabled
min receivefile size = 16384
passdb backend = smbpasswd
smb passwd file = /etc/samba/smbpasswd
[data]
comment = Seagate_3TB's data in Seagate Backup+ Desk
path = /tmp/mnt/Seagate_3TB/data
dos filetimes = yes
fake directory create times = yes
valid users = data, backup
invalid users = backup
read list = data
write list = data
Das Erstellen des Verzeichnisses beim SSH auf dem Router funktioniert wie erwartet (vielleicht nicht sehr überraschend):
daniel@RT-AC68U-AC48:/tmp/mnt/Seagate_3TB/data# ll
drwxrwxrwx 1 daniel root 0 Mar 15 00:07 stackoverflow/
daniel@RT-AC68U-AC48:/tmp/mnt/Seagate_3TB/data# mkdir test
daniel@RT-AC68U-AC48:/tmp/mnt/Seagate_3TB/data# ll
drwxrwxrwx 1 daniel root 0 Mar 15 00:07 stackoverflow/
drwxrwxrwx 1 daniel root 0 Apr 3 21:46 test/
-p
Flagge unterdrückt Warnungen, daher würde ich sagen, dass es normal ist, dass Sie nichts sehen. Können Sie uns die Ausgabe von zeigenrmdir test; strace mkdir test
?strace mkdir test
.Antworten:
Dies könnte eine
mkdir
ausfallende Festplatte / SSD sein, auf die nicht geschrieben werden kann.Da dies ein externes Laufwerk ist. Hat es eine Lese- / Schreibsperre?
Es kann schreibgeschützt anstelle von read + write gemountet werden.
Verwenden Sie
sudo mount -o remount,rw /partition/identifier /mount/point
:, um es als Lese- und Schreibzugriff neu zu laden. Quelle: https://askubuntu.com/a/175742/886917 .quelle
rsync
große Datenmengen auf die Festplatte zu kopieren.