LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   mdadm --manage /dev/md0 --add /dev/sdb1 returns device busy (http://www.linuxquestions.org/questions/linux-desktop-74/mdadm-manage-dev-md0-add-dev-sdb1-returns-device-busy-862872/)

JeepingAZ 02-15-2011 01:21 PM

mdadm --manage /dev/md0 --add /dev/sdb1 returns device busy
 
Some background:
I have created a RAID 1 array with two disks and three partitions. I removed one disk and used 'dd' to create a second duplicate disk. Both disks individually boot OK. I now want to add the second/duplicate disk back into the disk 1 RAID-1 array. I keep getting "Device or resource busy" on almost ALL mdadm commands I have tried. A search on this seems to indicate many people are having the same problem with no resolution found yet.
I have tried 'lsof' to see what is using my md0 array without success. Also setting the boot parameters to 'nodmraid' also does not work. I have SUSE 11.0. By the way to make sure the duplicated disk boots OK I changed the harddisk serial numbers in the /boot/grub/menu.lst file on disk 1 to /dev/md2 (root) BEFORE running 'dd'.

Here is my setup:
fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000be40b

Device Boot Start End Blocks Id System
/dev/sda1 1 131 1052226 fd Linux raid autodetect
/dev/sda2 132 118468 950541952+ fd Linux raid autodetect
/dev/sda3 118469 121079 20972857+ fd Linux raid autodetect
/dev/sda4 121080 121601 4192965 82 Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000be40b

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 131 1052226 fd Linux raid autodetect
/dev/sdb2 132 118468 950541952+ fd Linux raid autodetect
/dev/sdb3 118469 121079 20972857+ fd Linux raid autodetect
/dev/sdb4 121080 121601 4192965 82 Linux swap / Solaris

Disk /dev/md2: 21.4 GB, 21476130816 bytes
2 heads, 4 sectors/track, 5243196 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

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

Disk /dev/md0: 1077 MB, 1077465088 bytes
2 heads, 4 sectors/track, 263053 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

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

Disk /dev/md1: 973.3 GB, 973354819584 bytes
2 heads, 4 sectors/track, 237635454 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

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

cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4]
md1 : active raid1 sda2[0]
950541816 blocks super 1.0 [2/1] [U_]
bitmap: 144/454 pages [576KB], 1024KB chunk

md0 : active raid1 sda1[0]
1052212 blocks super 1.0 [2/1] [U_]
bitmap: 2/9 pages [8KB], 64KB chunk

md2 : active raid1 sda3[0]
20972784 blocks super 1.0 [2/1] [U_]
bitmap: 69/161 pages [276KB], 64KB chunk

I want to add in the second disk sdb1 to md0:

mdadm --detail /dev/md0
/dev/md0:
Version : 01.00.03
Creation Time : Fri Feb 11 15:31:43 2011
Raid Level : raid1
Array Size : 1052212 (1027.72 MiB 1077.47 MB)
Used Dev Size : 1052212 (1027.72 MiB 1077.47 MB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 0
Persistence : Superblock is persistent

Intent Bitmap : Internal

Update Time : Tue Feb 15 10:50:22 2011
State : active, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

Name : 0
UUID : 67693ed8:f3f8d464:3a1b5a82:de014fe6
Events : 126

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed

mdadm --manage /dev/md0 --add /dev/sdb1
mdadm: add new device failed for /dev/sdb1 as 2: Device or resource busy

and so it goes with most of the mdadm commands.

Guttorm 02-16-2011 06:38 AM

Hi

Adding to degraded md devices works even if it's busy. It's probably /dev/sdb1 that is busy. Are you sure it's not mounted already?

JeepingAZ 02-17-2011 01:18 PM

Disk Duplication for a RAID1 system.
 
I hadn't thought of umounting /dev/sdb1. Thanks.

I decided on a different path to duplicating my disks. After using 'dd' to duplicate RAID1 disk 1(sda) I replaced the original disk 1 with the duplicate, added disk 2(sdb) back into the md array and then watched disk 2 sync up.

Basically I don't save any time by duplicating disks as the md sync time is almost as slow as doing 'dd'. I tried using CloneZilla but it is no help. It seems to keep artifacts around that cause other / boot problems.

Thanks again.


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