L
L
l2k2014-04-08 16:38:39
linux
l2k, 2014-04-08 16:38:39

When connecting an HDD to the raid, it says Device or resource busy - what should I do?

I can't connect /dev/sda to /dev/md0 raid (which already has /dev/sdb).
Writes that /dev/sda is busy.
# fdisk -l /dev/sdb
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 / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e5a86
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 1855469567 927733760 fd Linux autodetect
# fdisk -l /dev /sda
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
163 heads, 57 sectors/track, 210259 cylinders, total 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 identifier: 0x0005cffd
Device Boot Start End Blocks Id System
/dev/sda1 2048 1855469567 927733760 fd Linux raid autodetect
# cfdisk /dev/sda
Funny thing:
sda1 swap (???)
sdb1 linux_raid_m
# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdb1[0]
927602496 blocks super 1.2 [2/1] [U_]
# mount
/dev/md0p2 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on / sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw )
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid, size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
# mdadm --add /dev/md0 /dev/sda1
mdadm: Cannot open /dev/sda1: Device or resource busy
# umount -l /dev/sda1
umount: /dev/sda1: not mounted
# umount -l /dev/sda
umount: /dev/sda: not mounted
# lsof | grep 'sda'
returns nothing
What to do? How to see where the sda ​​device is busy? Unmount it (or it might be busy - for some other reason) and add it to the raid?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Lopatin, 2014-04-08
@l2k

Maybe there is a swap? Do it just in case:
Well, I have doubts about the syntax of the mdadm command. According to the documentation, you need to write
mdadm /dev/md0 --add /dev/sda1

S
Sergey, 2014-04-08
@bk0011m

1. A common mistake when creating RAID devices is that dmraid-driver takes control of all the devices that should have been used in the new RAID device. You will get an error like this:
mdadm: Cannot open /dev/sdb1: Device or resource busy
To solve this problem, you must build a new initrd(initramfs) image without dmraid-driver. Example for "2.6.18-8.1.6.el5"-kernel:
mkinitrd --without-dmraid /boot/NO_DMRAID_initrd-2.6.18-8.1.6.el5.img 2.6.18-8.1.6.el5
After that , the system must be rebooted with a new initrd(initramfs). Edit your /boot/grub/grub.conf to include the new initrd(initramfs).
If for some reason it is not possible to build a new initrd (initramfs) image, the command can help
dmsetup remove_all
Here is the article: en.wikipedia.org/wiki/Mdadm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question