Linux - mdadm: cannot open /dev/sda1: Device or resource busy
Ahojte, chci si vytvořit jednoduchý raid 1 z disků /dev/sda1 a /dev/sdb1 na linux ubuntu a nedaří se mi to. Nedělám to poprvé a navíc postupuji i dle návodu na tomto webu. Dostávám chybu mdadm: cannot open /dev/sda1: Device or resource busy a z nějakého mně neznámého důvodu neproběhne vytvoření oddílů na disku /dev/sdb dle disku /dev/sda příkazem
Ahoj,
dle všeho disk /dev/sda má stále nastaveno, že se jedná o typ "linux raid member" s md127 - bude třeba na disku nastavit zero-superblock. Takže zkuste toto:
a pak vytvořte nový raid.
sfdisk -d /dev/sda | sfdisk /dev/sdb
. Níže dávám výpis z bashe. Díky za pomoc
[root@server7 ~]#gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.6
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: present
Found valid MBR and GPT. Which do you want to use?
1 - MBR
2 - GPT
3 - Create blank GPT
Your answer: 2
Using GPT and creating fresh protective MBR.
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-1953525134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-1953525134, default = 1953525134) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): fd00
Changed type of partition to 'Linux RAID'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
[root@server7 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931,5G 0 disk
└─sda1 8:1 0 931,5G 0 part
└─md127 9:127 0 931,4G 0 raid1
sdb 8:16 0 931,5G 0 disk
sdc 8:32 0 596,2G 0 disk
├─sdc1 8:33 0 953M 0 part /boot
├─sdc2 8:34 0 28G 0 part /
└─sdc3 8:35 0 7,5G 0 part [SWAP]
sdd 8:48 0 465,8G 0 disk
└─sdd1 8:49 0 465,8G 0 part
[root@server7 ~]#sfdisk -d /dev/sda | sfdisk /dev/sdb
Checking that no-one is using this disk right now ...
OK
Disk /dev/sdb: 121601 cylinders, 255 heads, 63 sectors/track
Old situation:
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sdb1 0+ 121601- 121602- 976762583+ ee GPT
/dev/sdb2 0 - 0 0 0 Empty
/dev/sdb3 0 - 0 0 0 Empty
/dev/sdb4 0 - 0 0 0 Empty
New situation:
Units: sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb1 1 1953525167 1953525167 ee GPT
/dev/sdb2 0 - 0 0 Empty
/dev/sdb3 0 - 0 0 Empty
/dev/sdb4 0 - 0 0 Empty
Warning: partition 1 does not end at a cylinder boundary
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table
Re-reading the partition table ...
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
[root@server7 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931,5G 0 disk
└─sda1 8:1 0 931,5G 0 part
└─md127 9:127 0 931,4G 0 raid1
sdb 8:16 0 931,5G 0 disk
sdc 8:32 0 596,2G 0 disk
├─sdc1 8:33 0 953M 0 part /boot
├─sdc2 8:34 0 28G 0 part /
└─sdc3 8:35 0 7,5G 0 part [SWAP]
sdd 8:48 0 465,8G 0 disk
└─sdd1 8:49 0 465,8G 0 part
[root@server7 ~]#mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sda1 /dev/sdb1
mdadm: cannot open /dev/sda1: Device or resource busy
ODPOVĚĎ
Ahoj,
dle všeho disk /dev/sda má stále nastaveno, že se jedná o typ "linux raid member" s md127 - bude třeba na disku nastavit zero-superblock. Takže zkuste toto:
mdadm -S /dev/md127
mdadm --zero-superblock /dev/sda1
a pak vytvořte nový raid.