Centos

當我嘗試格式化邏輯卷時“沒有這樣的文件或目錄”

  • October 9, 2018

我正在嘗試在 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

你有什麼想法嗎?

您可能需要先安裝 e4fsprogsCentOS 軟體包,然後才能創建 ext4 文件系統。

一般來說,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# 

引用自:https://unix.stackexchange.com/questions/181359