当我尝试格式化逻辑卷时,“没有这样的文件或目录”

当我尝试格式化逻辑卷时,“没有这样的文件或目录”

我正在尝试在 EC2 实例上的 CentOS 7 上创建逻辑卷。连接卷后,我使用 创建分区fdisk,然后开始创建逻辑卷:

pvcreate /dev/xvda1
vgcreate vgname /dev/xvda1
lvcreate -L 68G vgname -n lvname

在此实现之后,我尝试将逻辑卷格式化为 ext4,但是当我运行时,mkfs -t ext4 /dev/mapper/vgname-lvname我收到以下错误:

mkfs.ext4: No such file or directory

你知道发生了什么事吗?

答案1

你可能需要安装 e4fsprogs在创建 ext4 文件系统之前先进行 CentOS 软件包。

一般来说,mkfs只是一个前端对于一系列mkfs.*二进制文件。

请参见以下示例:

root@locutus:/home/asd# strace -f -e trace=execve mkfs -t asdasd /dev/whatever
execve("/sbin/mkfs", ["mkfs", "-t", "asdasd", "/dev/whatever"], [/* 18 vars */]) = 0
execve("/sbin/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/sbin/fs.d/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/sbin/fs/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/sbin/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/bin/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/sbin/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/sbin/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
execve("/bin\n/mkfs.asdasd", ["mkfs.asdasd", "/dev/whatever"], [/* 18 vars */]) = -1 ENOENT (No such file or directory)
mkfs.asdasd: No such file or directory
root@locutus:/home/asd# 

答案2

可能您的 RHEL 版本不支持 ext4,但您可以通过使用 yum install 安装 e4fsprogs 或下载软件包,然后使用 ftp 将其移动到您的服务器,然后使用 rpm -ivh 安装来解决此问题

相关内容