Tai*_*ine 5 linux raid partition xfs mdadm
首先,对不起,如果问题已经被问到并正确回答,我没有找到任何让我满意的东西。
我在数据中心租了一台专用机器,该机器运行 Debian 10 并在 RAID 1 中有两个驱动器,有 3 个分区:一个用于引导,一个用于交换,一个用于其余部分。
第三个 (/dev/md2) 使用 ext4 文件系统,我想改用 XFS。
我不习惯更改文件系统,这是我第一次拥有带有 RAID 的机器,所以我不知道该怎么做。
这是一个新安装,因此没有丢失数据的风险。
我尝试了一个,mkfs.xfs /dev/md2
但没有用:
root@Debian-105-buster-64-minimal ~ # mkfs.xfs /dev/md2
mkfs.xfs: /dev/md2 contains a mounted filesystem
Run Code Online (Sandbox Code Playgroud)
而且我不知道由于 RAID 应该如何卸载/挂载。
预先感谢您的帮助。
该df -Th
命令:
root@Debian-105-buster-64-minimal ~ # df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 32G 0 32G 0% /dev
tmpfs tmpfs 6.3G 516K 6.3G 1% /run
/dev/md2 ext4 437G 1.2G 413G 1% /
tmpfs tmpfs 32G 0 32G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/md1 ext3 487M 53M 409M 12% /boot
tmpfs tmpfs 6.3G 0 6.3G 0% /run/user/1000
Run Code Online (Sandbox Code Playgroud)
该fdisk -l
命令:
root@Debian-105-buster-64-minimal ~ # fdisk -l
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLB512HAJQ-00000
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0289e0d1
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 2048 67110911 67108864 32G fd Linux raid autodetect
/dev/nvme0n1p2 67110912 68159487 1048576 512M fd Linux raid autodetect
/dev/nvme0n1p3 68159488 1000213167 932053680 444.4G fd Linux raid autodetect
Disk /dev/nvme1n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLB512HAJQ-00000
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbcb5c0d2
Device Boot Start End Sectors Size Id Type
/dev/nvme1n1p1 2048 67110911 67108864 32G fd Linux raid autodetect
/dev/nvme1n1p2 67110912 68159487 1048576 512M fd Linux raid autodetect
/dev/nvme1n1p3 68159488 1000213167 932053680 444.4G fd Linux raid autodetect
Disk /dev/md1: 511 MiB, 535822336 bytes, 1046528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md0: 32 GiB, 34325135360 bytes, 67041280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md2: 444.3 GiB, 477076193280 bytes, 931789440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Run Code Online (Sandbox Code Playgroud)
mdstat :
root@Debian-105-buster-64-minimal ~ # cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 nvme0n1p3[0] nvme1n1p3[1]
465894720 blocks super 1.2 [2/2] [UU]
bitmap: 0/4 pages [0KB], 65536KB chunk
md0 : active (auto-read-only) raid1 nvme0n1p1[0] nvme1n1p1[1]
33520640 blocks super 1.2 [2/2] [UU]
resync=PENDING
md1 : active raid1 nvme0n1p2[0] nvme1n1p2[1]
523264 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Run Code Online (Sandbox Code Playgroud)
Mar*_*mer 13
/dev/md2 是你的根文件系统,所以如果你只是格式化它,这意味着你的服务器将永远消失。所以这是 mkfs 拒绝格式化正在运行的、已挂载的文件系统的一个很好的理由。
看到您的问题备份和恢复服务器现在完全超出了您的能力范围。
由于您在这台机器上还没有任何数据,只需使用您选择的文件系统重新安装它,这是实现目标的最简单、最安全的方法。
需要明确的是:“mkfs”会删除分区上的所有内容(我们通常称之为“格式化”)。您只能“格式化”未安装(未使用)的分区,而不能卸载根(系统)分区。您唯一的选择是从头开始重新运行安装,并在设置磁盘时更改默认选项。
但是,我不知道您为什么要将根文件系统格式化为 XFS 的任何原因。XFS 最适合大型(如 50 TB 到 2 PB)文件系统,通常在速度非常快的设备(如大型 RAID 阵列)上。ext4 作为根文件系统非常好,而且很可能 XFS 不会在您的配置中为您提供任何有价值的东西。