Score:1

mdadm : Cannot open /dev/sda: Device or resource busy

ng flag

I have 3 pendrive and I want to use for raid 5 When I run this command I get this output

 sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda dev/sdb /dev/sdc
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: super1.x cannot open /dev/sda: Device or resource busy
mdadm: ddf: Cannot use /dev/sda: Device or resource busy
mdadm: Cannot use /dev/sda: It is busy
mdadm: cannot open /dev/sda: Device or resource busy

when I restart machine. This time I got this output

sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda dev/sdb /dev/sdc
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: partition table exists on /dev/sda
mdadm: partition table exists on /dev/sda but will be lost or
       meaningless after creating array
mdadm: cannot open dev/sdb: No such file or directory

here is lsblk Output

lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
NAME           SIZE FSTYPE TYPE MOUNTPOINT
loop0           16M vfat   loop
sda           59,6G        disk
└─sda1        59,6G ntfs   part
sdb           28,9G        disk
└─sdb1        28,9G ntfs   part /media/whilone/WHILONE
sdc           57,3G        disk
└─sdc1        57,3G ntfs   part /media/whilone/sd64

dmstup output is No devices found

What is problem here?

Nikita Kipriyanov avatar
za flag
I suspect the problem is that you are trying to build a raid array out of partitioned (and mounted!) drives. Remove all partitions and partition tables (for instance, wipe disks with `dd if=/dev/zero of=/dev/sda` etc.), reload kernel parition information (just reboot) and try again. Notice, it is *impossible* to create array and not to lose prior information that was present on disks. Move it somewhere beforehands if it's still needed. And, most important, **never use RAID 5**, ever. It is forbidden.
TheCeylann avatar
ng flag
@NikitaKipriyanovWhy you said "never use RAID5' its about LINUX or for what I need raid for NAS sysyem. Waht is your suggestion RAID for NAS system?
Nikita Kipriyanov avatar
za flag
I meant anywhere. Linux MD RAID is just the particular case. If you're an expert you know all the caveats so you can justify the valid use of RAID 5. But you don't seem to be an expert, so here's a rule: never use RAID 5. Use any other level, RAID1, RAID6, nested ones — RAID10, RAID60 will do. Also notice the presence of special file systems where RAID is kind of built in, like ZFS and BTRFS, those fit for NAS very well, and using parity in ZFS is not nearly as dangerous as using block-level RAID 5.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.