Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Messed up trying to migrate drive to RAID1
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
IvanZD
Apprentice
Apprentice


Joined: 04 Jul 2005
Posts: 166

PostPosted: Fri May 11, 2012 12:46 pm    Post subject: Messed up trying to migrate drive to RAID1 Reply with quote

Hi,

I try to migrate from single drive to RAID1 setup, but it seems I screwed up data completely. Yeah, it looks like that. A hope still exist. Let see what we have:

I used this guide:
https://wiki.archlinux.org/index.php/Convert_a_single_drive_system_to_RAID

I copied data to degraded raid array, installed grub, rebooted few times into new degraded RAID system, everything appearently worked OK. Then I decided finally to add original drive to array. I did:

# sfdisk -d /dev/sdb | sfdisk /dev/sda

Checked with
# fdisk -l

to my eyes, everything was OK. I had now two identical drives, running on degraded raid 1 array.

Tried to add new drive to array, but I got:
# mdadm /dev/md0 -a /dev/sda2
mdadm: /dev/sda2 not large enough to join array

OK, guide said it is time to reboot if that happens. I issued reboot and after loading BIOS no go... it seems bad things happen.

Code:
root (hd1,0)
Filesystem type unknown, partition type 0x82
kernel /boot/kernel-3.2.12-gentoo-01 root=/dev/md0

Error 17: Cannot mount selected partition
Booing 'Gentoo Linux RAID 3.2.12-gento-01

Press any key to continue...


Booted rescuecd, tried to mount md0:
# mount /dev/md0 /mnt/gentoo
mount: /dev/md0: can't read superblock

On /dev/sda I now have two new partitions (destroyed original data), new array that worked until this reboot I cann't access anymore. Lost data?

I have a backup, though old one. Lot of data is gone if there is no solution.

What can I try to access this md0 array now? I don't understand how I could destroy it by copying partition table to original drive (sda) or by trying to add sda to array... I didn't nothing more that could harm md0, as far as I'm aware.

Any help please?

Additional information, as found, is in post below.

Thanks
_________________
http://www.meteoadriatic.net/


Last edited by IvanZD on Fri May 11, 2012 1:40 pm; edited 2 times in total
Back to top
View user's profile Send private message
IvanZD
Apprentice
Apprentice


Joined: 04 Jul 2005
Posts: 166

PostPosted: Fri May 11, 2012 1:00 pm    Post subject: Reply with quote

Anoher info,

if I try in rescuecd:
# mdadm --assemble --scan -v

I got this for sdb drive (where half of md0 should be):
mdadm: cannot open device /dev/sdb: Device or resource busy


How is that?


Another strange thing:

In dmesg:
md: Autodetecting RAID arrays
md: invalid raid superblock magic on sda2
md: sda2 does not have a valid v0.90 superblock, not importing!
md: could not open unknown-block(8,18)
md: Scanned 2 and added 0 devices.

...

why now sda2 when working half of array should be on sdb ?

And also there is NO /dev/sdb1 and /dev/sdb2 at all! Only /dev/sda1 and /dev/sda2

whereas,

fdisk -l /dev/sdb lists both /dev/sdb1 and /dev/sdb2, the same as fdisk -l /dev/sda lists /dev/sda1 and /dev/sda2


Code:
root@sysresccd /root % fdisk -l /dev/sda

Disk /dev/sda: 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    20973567    10485760   82  Linux swap / Solaris
/dev/sda2   *    20973568  1953525167   966275800   fd  Linux raid autodetect
root@sysresccd /root % 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 / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20973567    10485760   82  Linux swap / Solaris
/dev/sdb2   *    20973568  1953525167   966275800   fd  Linux raid autodetect
root@sysresccd /root % ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdc  /dev/sdc1  /dev/sdc2  /dev/sdd  /dev/sde  /dev/sdf  /dev/sdg
root@sysresccd /root %



dmesg reports both:

Code:
root@sysresccd /root % dmesg | grep sdb                       
[    2.742007] sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[    2.742424] sd 1:0:0:0: [sdb] 4096-byte physical blocks
[    2.742626] sd 1:0:0:0: [sdb] Write Protect is off
[    2.742773] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    2.742797] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.765260]  sdb: sdb1 sdb2
[    2.765604] sd 1:0:0:0: [sdb] Attached SCSI disk
root@sysresccd /root %



Very confusing!
_________________
http://www.meteoadriatic.net/
Back to top
View user's profile Send private message
IvanZD
Apprentice
Apprentice


Joined: 04 Jul 2005
Posts: 166

PostPosted: Fri May 11, 2012 2:40 pm    Post subject: Reply with quote

Good news!

I recovered from this $%&/ by using testdisk utility on /dev/sda. It found all old partitions and wrote new partition table so I'm now again up and running on original disk. I was thought I won't see it again, but all data is fine thanks to this nice utility.

Now I'm gonna first backup all data to external disk and then play with RAID freely.

Thanks for reading!
_________________
http://www.meteoadriatic.net/
Back to top
View user's profile Send private message
IvanZD
Apprentice
Apprentice


Joined: 04 Jul 2005
Posts: 166

PostPosted: Fri May 11, 2012 6:36 pm    Post subject: Reply with quote

I want to open this thread again. Sorry for confusion but I need to solve this because it is important to continue.

Now when I booted again from original disk and tried to access /dev/md0 to see if it will work, it doesn't (expected), but somehow device /dev/md127 showed up and there is my (still degraded, on /dev/sdb2) RAID array, WORKING! What the... how, why? I can't explain this. Why md0 become suddenly md127?! Will this change randomly again and again?

And... now when I booted my original disk, I DO HAVE /dev/sdb1 and /dev/sdb2, that I didn't have in systemrescuecd as you can see in above posts.

Can anybody explain all this mess to me? Can this be related to new udev things? I have installed udev-171-r5. I don't know right now which one is on rescuecd I used. Maybe this explains the differences in behaviour between my system and rescuecd, but this still doesn't explain to me how suddenly md0 became md127?

Thanks.
_________________
http://www.meteoadriatic.net/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum