https://access.redhat.com/solutions/727333
SOLUTION 已验证 - 已更新 2019年四月25日07:19 -
环境
- Red Hat Enterprise Linux (RHEL) 6
- Red Hat Enterprise Linux (RHEL) 7
问题
- Both the
mkfs.xfsand themkfs.ext4command stall on theioctl()system call while trying to create a new file system on an lvm volume. - The machine appears to hang, and does not respond
决议
In order to create the filesystem use the -K option with mkfs command. It will disables the block discard at creating time. More information on mkfs man page:
-K Keep, do not attempt to discard blocks at mkfs time
(discarding blocks initially is useful on solid state
devices and sparse / thin-provisioned storage).
Example:
# mkfs.ext4 -K </dev/mapper/path_to_lvm_volume> # For ext4 filesystem
# mkfs.xfs -K </dev/mapper/path_to_lvm_volume> # For XFS filesystem
根源
The mkfs command issues a block discard command on the disk, but the underlying storage device cannot handle it.
诊断步骤
Collect the strace logs for mkfs command:
# strace -f -tt -y -T -v -x -o /tmp/mkfs.out -s 4096 <mkfs command>
The strace logs for mkfs.xfs or mkfs.ext4 command shows that the command is hanging after issuing the ioctl 0x1277:
$ tail -2 mkfs.txt
1538 08:59:41.724086 write(1, "\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08", 13) = 13 <0.000053>
1538 08:59:41.724209 ioctl(3, 0x1277 <-------- hung after this
[...]
From the kernel source, 0x1277 ioctl corresponds to BLKDISCARD:
include/linux/fs.h:
------------------
344 #define BLKDISCARD _IO(0x12,119)
[...]
The mkfs command was issuing a block discard command to the disk but the disk device did not support the command, which caused the IO errors observed in first snip, which were then being logged.

本文介绍了解决在Red Hat Enterprise Linux (RHEL) 6和7上使用mkfs.xfs和mkfs.ext4命令创建LVM卷文件系统时出现的挂起问题。通过使用-K选项禁用块丢弃,可以避免由于不支持的存储设备导致的系统调用ioctl()失败。
1545

被折叠的 条评论
为什么被折叠?



