在 CentOS 下 mount 后出现乱码,通常是因为 文件系统编码与系统 locale 不一致,或者 mount 时未指定正确的字符集(iocharset / codepage)。下面按常见原因分析。
Windows 默认使用:
而 CentOS 默认 locale 多为:
en_US.UTF-8zh_CN.UTF-8如果挂载时没有指定字符集,中文就会变成乱码。
✅ 正确挂载方式:
FAT32 / vfat
mount -o iocharset=utf8 /dev/sdb1 /mnt/usb
或(老系统):
mount -o iocharset=gb2312 /dev/sdb1 /mnt/usb
NTFS
mount -t ntfs-3g -o iocharset=utf8 /dev/sdb1 /mnt/ntfs
检查:
locale
如果看到:
LANG=POSIX
LC_CTYPE=C
说明系统 不支持中文,即使文件本身正常也会显示乱码。
✅ 解决:
localectl set-locale LANG=zh_CN.UTF-8
或临时:
export LANG=zh_CN.UTF-8
Windows 共享经常乱码:
mount -t cifs //ip/share /mnt -o username=xxx,password=xxx,iocharset=utf8
如果是老 Windows:
iocharset=cp936
NFS 本身不处理文件名编码,依赖两端 locale 一致。
✅ 两端都必须:
LANG=zh_CN.UTF-8
mount -o loop,iocharset=utf8 xxx.iso /mnt
比如:
✅ 设置:
UTF-8locale
file 文件名
mount | grep 挂载点
CentOS mount 乱码,99% 是因为“文件系统编码 ≠ 挂载参数编码 ≠ 终端编码”
如果你愿意,可以告诉我:
locale 输出我可以直接给你一条可用的 mount 命令。