LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Format disk previously part of RAID setup (https://www.linuxquestions.org/questions/linux-newbie-8/format-disk-previously-part-of-raid-setup-4175612733/)

sim085 08-27-2017 03:48 PM

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?

wpeckham 08-27-2017 04:24 PM

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.

jefro 08-27-2017 05:44 PM

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.

sim085 09-02-2017 10:15 AM

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:

Originally Posted by jefro (Post 5752625)
# dd if=/dev/zero of=/dev/sdc bs=512 seek=$(( $(blockdev --getsz $DEVICE) - 1024 )) count=1024


wpeckham 09-02-2017 10:20 AM

After creating a partition, did you create a file system on the partition?

sim085 09-03-2017 05:47 PM

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:

Originally Posted by wpeckham (Post 5754905)
After creating a partition, did you create a file system on the partition?


wpeckham 09-03-2017 08:23 PM

Quote:

Originally Posted by sim085 (Post 5755293)
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?

The traditional DOS style partition in use since IBM-DOS v1 and still in use today is MBR partition tables. GPT partition tables are the new format released by Microsoft and used by WinXP Pro 64-bit and later, and Windows Server 2003 SP1 and later. GPT became the base for and part of the UEFI definition, and is considered a successor partitioning format for Microsoft systems.

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.

syg00 09-03-2017 09:37 PM

Just an older version of fdisk - current version supports gpt fine.
FWIW, I always prefer gpt, it has several advantages not always appreciated.

sim085 09-04-2017 11:29 AM

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:


...

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 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 label type: dos
Disk identifier: 0x7884bfa6

  Device Boot      Start        End      Blocks  Id  System
/dev/sdd1            2048  1953525167  976761560  83  Linux

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0xad3f14c7

  Device Boot      Start        End      Blocks  Id  System
/dev/sdc1            2048  1953525167  976761560  83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Quote:

Originally Posted by wpeckham (Post 5755324)
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.


syg00 09-04-2017 06:06 PM

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.