First, sorry if the question has already been asked and correctly answered, I did not find anything that satisfies me.
I rent a dedicated machine in a datacenter, the machine run with a Debian 10 and has two drives in RAID 1, there are 3 partitions: one for the boot, one for the swap and one for the rest.
The third (/dev/md2) uses the ext4 file system and I would like to use XFS instead.
I am not used to changing the filesystem and this is the first time I have a machine with RAID so I do not know how to do it.
This is a new installation so there is no risk of losing data.
I tried a mkfs.xfs /dev/md2
but it didn't work:
root@Debian-105-buster-64-minimal ~ # mkfs.xfs /dev/md2
mkfs.xfs: /dev/md2 contains a mounted filesystem
And I don't know how it should be unmount/mount due to the RAID.
Thank you in advance for the help.
The df -Th
command :
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
the fdisk -l
command :
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
The 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>
Best Answer
/dev/md2 is your root file system, so if you would just format this it means your server would be gone for good. So this is a very good reason why mkfs refuses to format a running, mounted file system.
Seeing your question backing up and restoring the server is entirely out of the scope of your abilities right now.
Since you don't have any data yet on this machine just reinstall it using your file system of choice, that's the easiest and safest way for you to achieve your goal.