Format disk previously part of RAID setup
Hello, I got two disks that were previously part of a RAID setup. On my current setup I have no RAID so I just want to format and mount to move some files onto these disks.
What I did is the following: Selected the disk using fdisk (fdisk /dev/sdc), deleted all partitions (d), created a new primary partition (n, p), changed the partition type to Linux (t, 83) and write the changes to disk (w). This created partition /dev/sdc1. I can see this correctly when I use "fdisk -l". However when I try to format the disk using the command "mkfs.ext4 /dev/sdc1" I get the error message "/dev/sdc1 is apparently in use by the system; will not make a filesystem here!". What I find strange is that if I try to mount (mount /dev/sdc1 /media/backup) I get the error message "mount: unknown filesystem type 'linux_raid_member'". Can someone help me? How can I format these disks? |
I suspect that you were on the correct track. Use fdisk (Actually a recent version of gparted may be better) and create a DOS partition table, then define a partition type linux and write out the changes. Now reboot the machine. No, this is not reasonable or logical but I have seen it help before.
THEN, after the reboot, see if you can use mkfs to format the partition. Couple of key points here: 1. do NOT just manipulate the partitions in the existing table, actually overwrite the partition table with a new one. 2. If the disk is too large, you may have issues with older programs or formats. You did not present information about what your base install consists of or the disk details. 3. on a very few disks I have had to scrub the disk (this can be done with dd, but there are programs that specifically take care of this) to remove all formatting and all partition table (as well as zapping the MBR space). 4. If that all fails, consider if you have a hardware mismatch or failure issue. Why were these retired from the raid array? If they are SMART drives, a diagnostic run may be in order. |
You should be able to use raid tools. Hardware or software may make a difference in tools used.
"If all failed, you may try the powerful dd: # dd if=/dev/zero of=$DEVICE bs=512 seek=$(( $(blockdev --getsz $DEVICE) - 1024 )) count=1024 " https://www.systutorials.com/136711/...ures-on-linux/ Be sure you are on correct drive with dd. |
In the end I finished using dd, however now when I mount I get the following message:
[root@mylinux ~]# mount /dev/sdc1 /mnt/backup1/ mount: /dev/sdc1 is write-protected, mounting read-only mount: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so. I just used fdisk to create the partition. What did I miss? Quote:
|
After creating a partition, did you create a file system on the partition?
|
I had forgot to do that. Now it works. Many thanks.
I just have one lat question on this; why do I get "WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion." on one of the disks when I enter the command fdisk -l? Quote:
|
Quote:
There is support for UEFI and GPT under recent versions of Linux, but the tools are not nearly as mature as those for MBR. Personally, when I repartition a disk for Linux I always use MBR. There is noting wrong with using GPT, and for certain disks (LARGE ones) that you might want to partition in ways not supported by MBR there can be some significant advantage. In this case you must have a GPT partition and the tool is letting you know that support for it in that tool is considered experimental. I would not worry about that much. If you can easily repartition using MBR I would, but if that is not convenient you can simply ignore that message. |
Just an older version of fdisk - current version supports gpt fine.
FWIW, I always prefer gpt, it has several advantages not always appreciated. |
I get this message under /dev/sdc which is the drive which I dd'd and created a new partition using fdisk. Also I did the same proceedure on another disk (/dev/sdd) but that one doesn't show such a message.
Code:
Quote:
|
Residual/random data that looks like gpt header. Easiest way to remove it (properly) is to use gdisk and zap the offending bits.
|
All times are GMT -5. The time now is 11:09 PM. |