AlexTheMaster
27.06.2013, 23.57
nessuno sa darmi qualche consiglio??
A common error when creating RAID devices is that the dmraid-driver has taken control of all the devices that are to be used in the new RAID device. Error-messages like this will occur:
mdadm: Cannot open /dev/sdb1: Device or resource busy
Typically, the solution to this problem involves adding the "nodmraid" kernel parameter to the boot loader config. Another way this error can present itself is if the device mapper has its way with the drives. Issue 'dmsetup table' see if the drive in question is listed. 'dmsetup remove' will remove the drive from device mapper and the "Device or resource busy" error will go away as well.
dmsetup remove md1
alexthemaster@:~$ sudo -s [sudo] password for alexthemaster: sh-4.2# sfdisk -d /dev/sda | sfdisk --force /dev/sdb Checking that no-one is using this disk right now ... OK Disk /dev/sdb: 91201 cylinders, 255 heads, 63 sectors/track sfdisk: ERROR: sector 0 does not have an MSDOS signature /dev/sdb: unrecognised partition table type Old situation: No partitions found New situation: Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/sdb1 * 4096 20975616 20971521 fd Linux RAID autodetect /dev/sdb2 20975617 1464092672 1443117056 fd Linux RAID autodetect /dev/sdb3 1464092673 1465144064 1051392 82 Linux swap / Solaris /dev/sdb4 0 - 0 0 Empty Warning: partition 1 does not end at a cylinder boundary 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).) sh-4.2# exit exit alexthemaster@:~$ fdisk -l alexthemaster@:~$ sudo fdisk -l Disk /dev/sda: 750.2 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00044521 Device Boot Start End Blocks Id System /dev/sda1 * 1 1306 10485760+ fd Linux RAID autodetect /dev/sda2 1306 91136 721558528 fd Linux RAID autodetect /dev/sda3 91136 91201 525696 82 Linux swap / Solaris Disk /dev/sdb: 750.2 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 * 1 1306 10485760+ fd Linux RAID autodetect /dev/sdb2 1306 91136 721558528 fd Linux RAID autodetect /dev/sdb3 91136 91201 525696 82 Linux swap / Solaris Disk /dev/md2: 738.9 GB, 738875867136 bytes 2 heads, 4 sectors/track, 180389616 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/md2 doesn't contain a valid partition table Disk /dev/md1: 10.7 GB, 10737352704 bytes 2 heads, 4 sectors/track, 2621424 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/md1 doesn't contain a valid partition table alexthemaster@:~$ mdadm --misc --help Usage: mdadm misc_option devices... This usage is for performing some task on one or more devices, which may be arrays or components, depending on the task. The --misc option is not needed (though it is allowed) and is assumed if the first argument in a misc option. Options that are valid with the miscellaneous mode are: --query -Q : Display general information about how a device relates to the md driver --detail -D : Display details of an array --detail-platform : Display hardware/firmware details --examine -E : Examine superblock on an array component --examine-bitmap -X: Display contents of a bitmap file --zero-superblock : erase the MD superblock from a device. --run -R : start a partially built array --stop -S : deactivate array, releasing all resources --readonly -o : mark array as readonly --readwrite -w : mark array as readwrite --test -t : exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing --wait -W : wait for resync/rebuild/recovery to finish alexthemaster@ns37697:~$ mdadm --misc --detail /dev/md1 mdadm: must be super-user to perform this action alexthemaster@ns37697:~$ sudo mdadm --misc --detail /dev/md1 /dev/md1: Version : 0.90 Creation Time : Mon Nov 21 01:03:21 2011 Raid Level : raid1 Array Size : 10485696 (10.00 GiB 10.74 GB) Used Dev Size : 10485696 (10.00 GiB 10.74 GB) Raid Devices : 2 Total Devices : 1 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Thu Jun 20 09:42:47 2013 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 UUID : 2d262613:49d99f7c:a4d2adc2:26fd5302 Events : 0.4401475 Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 0 0 1 removed alexthemaster@:~$ sudo mdadm /dev/md1 --manage --add /dev/sdb1 mdadm: Cannot open /dev/sdb1: Device or resource busy alexthemaster@:~$ sudo mdadm /dev/md1 --manage --add /dev/sdb1 mdadm: Cannot open /dev/sdb1: Device or resource busy alexthemaster@:~$ sudo -s sh-4.2# mdadm /dev/md1 --manage --add /dev/sdb1 mdadm: Cannot open /dev/sdb1: Device or resource busy
sudo sfdisk -d /dev/sda | sfdisk --force /dev/sdb
$ sudo -s # sfdisk -d /dev/sda | sfdisk --force /dev/sdb # exit $
alexthemaster@:~$ sudo fdisk -l Disk /dev/sda: 750.2 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00044521 Device Boot Start End Blocks Id System /dev/sda1 * 1 1306 10485760+ fd Linux RAID autodetect /dev/sda2 1306 91136 721558528 fd Linux RAID autodetect /dev/sda3 91136 91201 525696 82 Linux swap / Solaris Disk /dev/sdb: 750.2 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table Disk /dev/md2: 738.9 GB, 738875867136 bytes 2 heads, 4 sectors/track, 180389616 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/md2 doesn't contain a valid partition table Disk /dev/md1: 10.7 GB, 10737352704 bytes 2 heads, 4 sectors/track, 2621424 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/md1 doesn't contain a valid partition table
alexthemaster@:~$ sudo sfdisk -d /dev/sda | sfdisk --force /dev/sdb /dev/sdb: Permission denied sfdisk: cannot open /dev/sdb read-write
# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2612 20971520+ fd Linux raid autodetect
/dev/sda2 2612 121536 955260928 fd Linux raid autodetect
/dev/sda3 121536 121601 525536 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
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2612 20971520+ fd Linux raid autodetect
/dev/sdb2 2612 121536 955260928 fd Linux raid autodetect
/dev/sdb3 121536 121601 525536 82 Linux swap / Solaris
Disk /dev/md2: 978.1 GB, 978187124736 bytes
2 heads, 4 sectors/track, 238815216 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md2 doesn't contain a valid partition table
Disk /dev/md1: 21.4 GB, 21474770944 bytes
2 heads, 4 sectors/track, 5242864 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md1 doesn't contain a valid partition table