Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Re-use disks from Software RAID array

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
lafaki
Posts: 13
Joined: 2011-08-09 13:13

Re-use disks from Software RAID array

#1 Post by lafaki »

Hi!

I have a RAID 1 array with two disks running Debian (not an up to date OS version).
I provide at the bottom of the email the fdisk -l command output.

The disks are formatted with NTFS-3G, they have only data and not any primary partition for booting the OS.

What I want to do is:
- stop the RAID
- remove the disks
- keep all data in one of the two disks so that the data is accessible by another PC running Windows
- format the other disk and use it in a Windows PC

When searching a bit, I have come across the below commands. Would they work?

Any help and advice would be highly appreciated!

Thanks in advance,
Akis

STEP 1 - Remove one drive (/dev/sdb1) from the RAID array
mdadm /dev/md0 --fail /dev/sdb1
mdadm /dev/md0 --remove /dev/sdb1

Question: after this step, can I access all data on the /dev/sdb1 from a Windows PC? What about the remaining software RAID metadata?

STEP 2 - Remove the RAID metadata from the other drive (/dev/sda1)
mdadm --zero-superblock /dev/sda1

Question: after this step, can I properly reformat /dev/sdb1 and reuse in a Windows PC?

Question: Do I need to run any stop command at any stage? e.g. mdadm --stop /dev/md0

_________________________________________________________________________________________

sudo fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00019772

Device Boot Start End Blocks Id System
/dev/sda1 1 243201 1953512001 fd Linux raid autodetect

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006d8a1

Device Boot Start End Blocks Id System
/dev/sdb1 1 243201 1953512001 fd Linux raid autodetect

Disk /dev/md0: 2000.4 GB, 2000396222464 bytes
2 heads, 4 sectors/track, 488377984 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb11cc0b1

Device Boot Start End Blocks Id System
/dev/md0p1 1 488377984 1953511934 7 HPFS/NTFS


Disk /dev/sdc: 3999 MB, 3999268864 bytes
124 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00061b0f

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 753 2891776 83 Linux
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 32, 33) logical=(0, 33, 3)
Partition 1 has different physical/logical endings:
phys=(360, 34, 58) logical=(752, 68, 8)
Partition 1 does not end on cylinder boundary.
/dev/sdc2 753 1016 1010689 5 Extended
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(360, 67, 26) logical=(752, 101, 9)
Partition 2 has different physical/logical endings:
phys=(486, 22, 48) logical=(1015, 91, 62)
Partition 2 does not end on cylinder boundary.
/dev/sdc5 753 1016 1010688 82 Linux swap / Solaris

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Re-use disks from Software RAID array

#2 Post by p.H »

lafaki wrote:STEP 1 - Remove one drive (/dev/sdb1) from the RAID array
mdadm /dev/md0 --fail /dev/sdb1mdadm /dev/md0 --remove /dev/sdb1
Question: after this step, can I access all data on the /dev/sdb1 from a Windows PC?
No. It would be possible if
- the RAID partition /dev/sdb1 has metadata version 0.90 or 1.0 (at the end of the partition)
- and the RAID array /dev/md0 was not partitioned (no partition table at the beginning).

In order to access existing data on the disk, you must also find out the raw position of the filesystem, remove RAID metadata and create a new partition at the filesystem location.
lafaki wrote:STEP 2 - Remove the RAID metadata from the other drive (/dev/sda1)
mdadm --zero-superblock /dev/sda1
Question: after this step, can I properly reformat /dev/sdb1 and reuse in a Windows PC?
Yes.
lafaki wrote:Question: Do I need to run any stop command at any stage? e.g. mdadm --stop /dev/md0
Yes, before removing RAID metadata. If you stop the array, you cannot (and do not have to) remove one disk from the array.

PS : What is this obsolete version of fdisk that you are using ? Modern versions should use unit=sector, not unit=cylinder (deprecated and inaccurate).

lafaki
Posts: 13
Joined: 2011-08-09 13:13

Re: Re-use disks from Software RAID array

#3 Post by lafaki »

Hi,

Thanks for your help!

After considering the risk of loosing the data, I decided to follow another path that worked at the end fine.

- In the Disk Utility of the Debian OS, I removed one disk from the RAID 1 array
- For that disk (/dev/sdb)
o I deleted the RAID partition
o I created a GUID partition and formatted the drive as NTFS
o I mounted the new NTFS partition and copied all data from the RAID array to this drive (I also connected this drive to a Windows PC and checked that all data was accessible)
- I then unmounted the RAID 1 array and stopped it
- For the remaining disk in the array (/dev/sda)
o I deleted the RAID partition
o I created a GUID partition and formatted the drive as NTFS

In my case transferring the data internally from one SATA disk to another was faster than to an external USB drive.

Cheers,
Akis

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Re-use disks from Software RAID array

#4 Post by p.H »

lafaki wrote:After considering the risk of loosing the data, I decided to follow another path that worked at the end fine.
Wise decision. I would have chosen the faster method which leaves data on location, but I would not recommend it to users who are unexperienced in the field.

Post Reply