LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to fail software raid partition but errors saying device busy (https://www.linuxquestions.org/questions/linux-server-73/how-to-fail-software-raid-partition-but-errors-saying-device-busy-4175490263/)

narnie 01-05-2014 07:23 PM

How to fail software raid partition but errors saying device busy
 
I have the following software raid made using mdadm:

Code:

dell-desktop dev # cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb6[1]
      717040448 blocks super 1.2 [2/1] [_U]
     
unused devices: <none>

I have a failed drive I am replacing (which no longer appears above. It was /dev/sda1), and need to fail the /dev/sdb6 device so I can do some work on it (won't get into that), re-add it, then add the new hard disk to the array.

Also,

Code:

dell-desktop dev # fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 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 identifier: 0x00011318

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1            2048    41945087    20971520  83  Linux
/dev/sdb2        41945088  1953523711  955789312    5  Extended
/dev/sdb5        41947136    54530047    6291456  82  Linux swap / Solaris
/dev/sdb6      519178240  1953523711  717172736  fd  Linux raid autodetect

Disk /dev/md0: 734.2 GB, 734249418752 bytes
2 heads, 4 sectors/track, 179260112 cylinders, total 1434080896 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 identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

/dev/md0 is not mounted. I get the following response running:

Code:

dell-desktop dev # mdadm --fail /dev/md0 /dev/sdb6
mdadm: set device faulty failed for /dev/sdb6:  Device or resource busy

I can't figure out what has the device busy.

Running lsof, fuser, and losetup shows nothing is using the device (as expected since it is a fresh boot and nothing is mounted regarding it). There are no exports on this, but I have no way I know of to check to see if a kernel module is holding onto it.

How can I find out what has it busy, fix that, and fail the device so I can remove it from the system, work on it, then re-add it?

Oddly, I can do:

Code:

# mdadmin -S /dev/md0
Successfully, despite the report that /dev/sdb6 is busy.

This makes me actually think it is /dev/md0 that is latching onto it since it doesn't have another raid device to hold onto so it is "desperately clinging to it."

With thanks for the help ...

smallpond 01-05-2014 09:50 PM

I don't think you can fail the last drive of a raidset. You can stop the array with
Code:

mdadm -S /dev/md0
This will not hurt the data on it. When you are ready, assemble it back to the same state:
Code:

mdadm -A /dev/md0 /dev/sdb6
You might be better off to add and resync the new drive before you work on sdb so you have a backup.


All times are GMT -5. The time now is 06:21 PM.