我有 2 台 moxa 计算机(Debian 9),都安装了 SD 卡。问题出在一台计算机的 SD 卡安装上。我无法更改群组所有权
/dev/mmcblk0p1 /media/sd-mmcblk0p1 vfat rw,relatime,gid=100,fmask=0002,dmask=0002,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
ls -al
文件夹的;
root@AAGCloudwatcher:/media/sd-mmcblk0p1# ls -al
total 129
drwxrwxr-x 5 root users 32768 Sep 8 20:39 .
drwxr-xr-x 1 root root 1024 Sep 7 22:32 ..
drwxrwxr-x 3 root users 32768 Jul 15 21:15 config
drwxrwxr-x 7 root users 32768 Sep 7 19:13 data
drwxrwxr-x 2 root users 32768 Sep 7 19:44 tmp
我想在另一台 moxa 计算机上读取和写入文件。使用 samba,我设法访问该文件夹并查看数据。但不写。现在我注意到该组的所有权有所不同。现在所有权是 root:users
SOLO@AAGCloudwatcher:/media/sd-mmcblk0p1$ sudo chown SOLO:SOLO data
chown: changing ownership of 'data': Operation not permitted
我用谷歌搜索了很多:安装的驱动器是FAT32,文件夹更新为777读/写权限。我还有另一台电脑也安装了 SD 卡,并且遇到了同样的问题,我无法使用另一台 moxa 电脑和 SD 卡进行写入。然后我做了同样的事情,这就像一个魅力。当所有权改变时,我将能够在该文件夹中进行通信和写入。重要提示:当我在本地 MOXA 计算机上工作时,我可以在文件夹中写入内容。
chgrp
也不行。
lsattr 给了我这个:
root@AAGCloudwatcher:/media/sd-mmcblk0p1# lsattr
lsattr: Inappropriate ioctl for device While reading flags on ./data
lsattr: Inappropriate ioctl for device While reading flags on ./config
lsattr: Inappropriate ioctl for device While reading flags on ./tmp
cat /proc/mounts
给我这个
/dev/root / ext4 rw,noatime,errors=remount-ro,data=ordered 0 0
devtmpfs /dev devtmpfs rw,relatime,size=247604k,nr_inodes=61901,mode=755 0 0
/dev/mmcblk1p3 /overlayfs ext4 rw,relatime,data=ordered 0 0
overlay /var overlay rw,relatime,lowerdir=/var,upperdir=/overlayfs/v1//var_rw/upper,workdir=/overlayfs/v1//var_rw/work 0 0
overlay /etc overlay rw,relatime,lowerdir=/etc,upperdir=/overlayfs/v1//etc_rw/upper,workdir=/overlayfs/v1//etc_rw/work 0 0
overlay /home overlay rw,relatime,lowerdir=/home,upperdir=/overlayfs/v1//home_rw/upper,workdir=/overlayfs/v1//home_rw/work 0 0
overlay /root overlay rw,relatime,lowerdir=/root,upperdir=/overlayfs/v1//root_rw/upper,workdir=/overlayfs/v1//root_rw/work 0 0
overlay /sbin overlay rw,relatime,lowerdir=/sbin,upperdir=/overlayfs/v1//sbin_rw/upper,workdir=/overlayfs/v1//sbin_rw/work 0 0
overlay /bin overlay rw,relatime,lowerdir=/bin,upperdir=/overlayfs/v1//bin_rw/upper,workdir=/overlayfs/v1//bin_rw/work 0 0
overlay /usr overlay rw,relatime,lowerdir=/usr,upperdir=/overlayfs/v1//usr_rw/upper,workdir=/overlayfs/v1//usr_rw/work 0 0
overlay /lib overlay rw,relatime,lowerdir=/lib,upperdir=/overlayfs/v1//lib_rw/upper,workdir=/overlayfs/v1//lib_rw/work 0 0
overlay /tmp overlay rw,relatime,lowerdir=/tmp,upperdir=/overlayfs/v1//tmp_rw/upper,workdir=/overlayfs/v1//tmp_rw/work 0 0
overlay /mnt overlay rw,relatime,lowerdir=/mnt,upperdir=/overlayfs/v1//mnt_rw/upper,workdir=/overlayfs/v1//mnt_rw/work 0 0
overlay /opt overlay rw,relatime,lowerdir=/opt,upperdir=/overlayfs/v1//opt_rw/upper,workdir=/overlayfs/v1//opt_rw/work 0 0
overlay /media overlay rw,relatime,lowerdir=/media,upperdir=/overlayfs/v1//media_rw/upper,workdir=/overlayfs/v1//media_rw/work 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
/dev/mmcblk0p1 /media/sd-mmcblk0p1 vfat rw,relatime,gid=100,fmask=0002,dmask=0002,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /run/user/1001 tmpfs rw,nosuid,nodev,relatime,size=51180k,mode=700,uid=1001,gid=1001 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
我期望得到这样的文件夹所有权,然后我认为我的问题就解决了。
root@AAGCloudwatcher:/media/sd-mmcblk0p1# ls -al
total 129
drwxrwxr-x 5 root users 32768 Sep 8 20:39 .
drwxr-xr-x 1 root root 1024 Sep 7 22:32 ..
drwxrwxr-x 3 SOLO SOLO 32768 Jul 15 21:15 config
drwxrwxr-x 7 SOLO SOLO 32768 Sep 7 19:13 data
drwxrwxr-x 2 SOLO SOLO 32768 Sep 7 19:44 tmp
谢谢。
更新:安装的输出:
root@AAGCloudwatcher:/home/SOLO# mount
/dev/mmcblk1p2 on / type ext4 (rw,noatime,errors=remount-ro,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=247604k,nr_inodes=61901,mode=755)
/dev/mmcblk1p3 on /overlayfs type ext4 (rw,relatime,data=ordered)
overlay on /var type overlay (rw,relatime,lowerdir=/var,upperdir=/overlayfs/v1//var_rw/upper,workdir=/overlayfs/v1//var_rw/work)
overlay on /etc type overlay (rw,relatime,lowerdir=/etc,upperdir=/overlayfs/v1//etc_rw/upper,workdir=/overlayfs/v1//etc_rw/work)
overlay on /home type overlay (rw,relatime,lowerdir=/home,upperdir=/overlayfs/v1//home_rw/upper,workdir=/overlayfs/v1//home_rw/work)
overlay on /root type overlay (rw,relatime,lowerdir=/root,upperdir=/overlayfs/v1//root_rw/upper,workdir=/overlayfs/v1//root_rw/work)
overlay on /sbin type overlay (rw,relatime,lowerdir=/sbin,upperdir=/overlayfs/v1//sbin_rw/upper,workdir=/overlayfs/v1//sbin_rw/work)
overlay on /bin type overlay (rw,relatime,lowerdir=/bin,upperdir=/overlayfs/v1//bin_rw/upper,workdir=/overlayfs/v1//bin_rw/work)
overlay on /usr type overlay (rw,relatime,lowerdir=/usr,upperdir=/overlayfs/v1//usr_rw/upper,workdir=/overlayfs/v1//usr_rw/work)
overlay on /lib type overlay (rw,relatime,lowerdir=/lib,upperdir=/overlayfs/v1//lib_rw/upper,workdir=/overlayfs/v1//lib_rw/work)
overlay on /tmp type overlay (rw,relatime,lowerdir=/tmp,upperdir=/overlayfs/v1//tmp_rw/upper,workdir=/overlayfs/v1//tmp_rw/work)
overlay on /mnt type overlay (rw,relatime,lowerdir=/mnt,upperdir=/overlayfs/v1//mnt_rw/upper,workdir=/overlayfs/v1//mnt_rw/work)
overlay on /opt type overlay (rw,relatime,lowerdir=/opt,upperdir=/overlayfs/v1//opt_rw/upper,workdir=/overlayfs/v1//opt_rw/work)
overlay on /media type overlay (rw,relatime,lowerdir=/media,upperdir=/overlayfs/v1//media_rw/upper,workdir=/overlayfs/v1//media_rw/work)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/
fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p1 on /media/sd-mmcblk0p1 type vfat (rw,relatime,gid=100,fmask=0002,dmask=0002,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=51180k,mode=700,uid=1001,gid=1001)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
fcheck 给了我这个:
root@AAGCloudwatcher:/home/SOLO# fsck /media/sd-mmcblk0p1/
fsck from util-linux 2.29.2
e2fsck 1.43.4 (31-Jan-2017)
fsck.ext2: Is a directory while trying to open /media/sd-mmcblk0p1
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
答案1
评论中的@luciano-andress-martini 是正确的:问题是FAT32 文件系统不支持unix 用户和组所有权,也不支持访问权限。
因此,该文件系统上的所有文件和目录都将具有相同的所有者和组,并且无法使用chown
/更改它们。chgrp
但是,您可以指定所有文件的所有者和组以及umask
/permissions 作为挂载选项:
mount -o uid=SOLO,gid=SOLO /dev/mmcblk0p1 /media/sd-mmcblk0p1
您可以在安装时手动指定这些或在/etc/fstab
.查看所有vfat 挂载选项。