| 373 | |
| 374 | == two of two devices alive but not same == |
| 375 | * degraded RAID1に対して、(片方のHDDだけattachされている状態で)何らかの操作を行い、後から古いHDDをre-addした際の挙動を調べる |
| 376 | |
| 377 | === make Logical volume on degraded RAID1 === |
| 378 | ==== status ==== |
| 379 | * mitty@ubuntu-haa:~$ ls -l /dev/sd* |
| 380 | {{{ |
| 381 | |
| 382 | brw-rw---- 1 root disk 8, 16 2011-03-25 16:16 /dev/sdb |
| 383 | brw-rw---- 1 root disk 8, 17 2011-03-25 16:16 /dev/sdb1 |
| 384 | }}} |
| 385 | |
| 386 | * mitty@ubuntu-haa:~$ cat /proc/mdstat |
| 387 | {{{ |
| 388 | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] |
| 389 | md0 : inactive sdb1[0](S) |
| 390 | 2047936 blocks |
| 391 | |
| 392 | unused devices: <none> |
| 393 | }}} |
| 394 | |
| 395 | * mitty@ubuntu-haa:~$ sudo mdadm -E /dev/sdb1 |
| 396 | {{{ |
| 397 | /dev/sdb1: |
| 398 | Magic : a92b4efc |
| 399 | Version : 00.90.00 |
| 400 | UUID : 32578407:6f33f50b:893cf340:745f5dce (local to host ubuntu-haa) |
| 401 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 402 | Raid Level : raid1 |
| 403 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 404 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 405 | Raid Devices : 2 |
| 406 | Total Devices : 2 |
| 407 | Preferred Minor : 0 |
| 408 | |
| 409 | Update Time : Thu Mar 24 21:25:32 2011 |
| 410 | State : clean |
| 411 | Active Devices : 2 |
| 412 | Working Devices : 2 |
| 413 | Failed Devices : 0 |
| 414 | Spare Devices : 0 |
| 415 | Checksum : e3889399 - correct |
| 416 | Events : 34 |
| 417 | |
| 418 | |
| 419 | Number Major Minor RaidDevice State |
| 420 | this 0 8 17 0 active sync /dev/sdb1 |
| 421 | |
| 422 | 0 0 8 17 0 active sync /dev/sdb1 |
| 423 | 1 1 8 33 1 active sync |
| 424 | }}} |
| 425 | |
| 426 | * mitty@ubuntu-haa:~$ sudo mdadm -R /dev/md0 |
| 427 | {{{ |
| 428 | mdadm: started /dev/md0 |
| 429 | }}} |
| 430 | * mitty@ubuntu-haa:~$ cat /proc/mdstat |
| 431 | {{{ |
| 432 | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] |
| 433 | md0 : active raid1 sdb1[0] |
| 434 | 2047936 blocks [2/1] [U_] |
| 435 | |
| 436 | unused devices: <none> |
| 437 | }}} |
| 438 | |
| 439 | ==== make /dev/vgnfs/drbd ==== |
| 440 | * mitty@ubuntu-haa:~$ sudo lvcreate --size 1.5G -n drbd vgnfs |
| 441 | {{{ |
| 442 | Logical volume "drbd" created |
| 443 | }}} |
| 444 | * mitty@ubuntu-haa:~$ sudo lvdisplay |
| 445 | {{{ |
| 446 | --- Logical volume --- |
| 447 | LV Name /dev/vgnfs/drbd |
| 448 | VG Name vgnfs |
| 449 | LV UUID dNxdNj-hZCZ-GMrC-woMk-0hA2-f3oR-sBsrHI |
| 450 | LV Write Access read/write |
| 451 | LV Status available |
| 452 | # open 0 |
| 453 | LV Size 1.50 GiB |
| 454 | Current LE 48 |
| 455 | Segments 1 |
| 456 | Allocation inherit |
| 457 | Read ahead sectors auto |
| 458 | - currently set to 256 |
| 459 | Block device 251:0 |
| 460 | |
| 461 | }}} |
| 462 | |
| 463 | ==== mdadm Events increased ==== |
| 464 | * mitty@ubuntu-haa:~$ sudo mdadm -E /dev/sdb1 |
| 465 | {{{ |
| 466 | /dev/sdb1: |
| 467 | Magic : a92b4efc |
| 468 | Version : 00.90.00 |
| 469 | UUID : 32578407:6f33f50b:893cf340:745f5dce (local to host ubuntu-haa) |
| 470 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 471 | Raid Level : raid1 |
| 472 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 473 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 474 | Raid Devices : 2 |
| 475 | Total Devices : 1 |
| 476 | Preferred Minor : 0 |
| 477 | |
| 478 | Update Time : Fri Mar 25 15:28:34 2011 |
| 479 | State : clean |
| 480 | Active Devices : 1 |
| 481 | Working Devices : 1 |
| 482 | Failed Devices : 1 |
| 483 | Spare Devices : 0 |
| 484 | Checksum : e389914b - correct |
| 485 | Events : 36 |
| 486 | |
| 487 | |
| 488 | Number Major Minor RaidDevice State |
| 489 | this 0 8 17 0 active sync /dev/sdb1 |
| 490 | |
| 491 | 0 0 8 17 0 active sync /dev/sdb1 |
| 492 | 1 1 0 0 1 faulty removed |
| 493 | }}} |
| 494 | |
| 495 | == rescue with two devices on Knoppix == |
| 496 | === devices === |
| 497 | * root@Knoppix:~# mdadm -E /dev/sd[ab]1 |
| 498 | {{{ |
| 499 | /dev/sda1: |
| 500 | Magic : a92b4efc |
| 501 | Version : 00.90.00 |
| 502 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 503 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 504 | Raid Level : raid1 |
| 505 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 506 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 507 | Raid Devices : 2 |
| 508 | Total Devices : 1 |
| 509 | Preferred Minor : 0 |
| 510 | |
| 511 | Update Time : Fri Mar 25 15:28:34 2011 |
| 512 | State : clean |
| 513 | Active Devices : 1 |
| 514 | Working Devices : 1 |
| 515 | Failed Devices : 1 |
| 516 | Spare Devices : 0 |
| 517 | Checksum : e389914b - correct |
| 518 | Events : 0.36 |
| 519 | |
| 520 | |
| 521 | Number Major Minor RaidDevice State |
| 522 | this 0 8 17 0 active sync /dev/sdb1 |
| 523 | |
| 524 | 0 0 8 17 0 active sync /dev/sdb1 |
| 525 | 1 1 0 0 1 faulty removed |
| 526 | /dev/sdb1: |
| 527 | Magic : a92b4efc |
| 528 | Version : 00.90.00 |
| 529 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 530 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 531 | Raid Level : raid1 |
| 532 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 533 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 534 | Raid Devices : 2 |
| 535 | Total Devices : 2 |
| 536 | Preferred Minor : 0 |
| 537 | |
| 538 | Update Time : Thu Mar 24 21:25:32 2011 |
| 539 | State : clean |
| 540 | Active Devices : 2 |
| 541 | Working Devices : 2 |
| 542 | Failed Devices : 0 |
| 543 | Spare Devices : 0 |
| 544 | Checksum : e38893ab - correct |
| 545 | Events : 0.34 |
| 546 | |
| 547 | |
| 548 | Number Major Minor RaidDevice State |
| 549 | this 1 8 33 1 active sync /dev/sdc1 |
| 550 | |
| 551 | 0 0 8 17 0 active sync /dev/sdb1 |
| 552 | 1 1 8 33 1 active sync /dev/sdc1 |
| 553 | }}} |
| 554 | |
| 555 | === assemble md0 and md1 === |
| 556 | * 上記の # mdadm -E /dev/sd[ab]1 の結果から、RAID1デバイスのうち /dev/sda1 が最新であると推定されるが、その確認として /dev/sd[ab]1 をそれぞれRAID1としてAssembleする |
| 557 | |
| 558 | ==== assemble md0 ==== |
| 559 | * root@Knoppix:~# mdadm -A /dev/md0 -u 32578407:6f33f50b:893cf340:745f5dce |
| 560 | {{{ |
| 561 | mdadm: /dev/md0 has been started with 1 drive (out of 2). |
| 562 | }}} |
| 563 | * root@Knoppix:~# cat /proc/mdstat |
| 564 | {{{ |
| 565 | Personalities : [raid1] |
| 566 | md0 : active raid1 sda1[0] |
| 567 | 2047936 blocks [2/1] [U_] |
| 568 | |
| 569 | unused devices: <none> |
| 570 | }}} |
| 571 | * 自動的に最新のデバイスが選択されるのか、/dev/sda1から/dev/md0がassembleされる |
| 572 | * どちらが最新であるかどのように判断しているかが不明 (Events? Update Time?) |
| 573 | |
| 574 | ==== assemble md1 ==== |
| 575 | * root@Knoppix:~# mdadm -A /dev/md1 /dev/sdb1 |
| 576 | {{{ |
| 577 | mdadm: /dev/md1 assembled from 1 drive - need all 2 to start it (use --run to insist). |
| 578 | }}} |
| 579 | * root@Knoppix:~# cat /proc/mdstat |
| 580 | {{{ |
| 581 | Personalities : [raid1] |
| 582 | md1 : inactive sdb1[1](S) |
| 583 | 2047936 blocks |
| 584 | |
| 585 | md0 : active raid1 sda1[0] |
| 586 | 2047936 blocks [2/1] [U_] |
| 587 | |
| 588 | unused devices: <none> |
| 589 | }}} |
| 590 | * この時点では md1 は動いていない |
| 591 | |
| 592 | ==== scanning LVM ==== |
| 593 | * /dev/sda1 -> /dev/md0 のみが有効なので、/dev/vgnfs/drbdが正常に表示される |
| 594 | |
| 595 | * root@Knoppix:~# pvscan |
| 596 | {{{ |
| 597 | PV /dev/md0 VG vgnfs lvm2 [1.94 GB / 448.00 MB free] |
| 598 | Total: 1 [1.94 GB] / in use: 1 [1.94 GB] / in no VG: 0 [0 ] |
| 599 | }}} |
| 600 | * root@Knoppix:~# vgscan |
| 601 | {{{ |
| 602 | Reading all physical volumes. This may take a while... |
| 603 | Found volume group "vgnfs" using metadata type lvm2 |
| 604 | }}} |
| 605 | * root@Knoppix:~# lvscan |
| 606 | {{{ |
| 607 | inactive '/dev/vgnfs/drbd' [1.50 GB] inherit |
| 608 | }}} |
| 609 | * root@Knoppix:~# lvdisplay |
| 610 | {{{ |
| 611 | --- Logical volume --- |
| 612 | LV Name /dev/vgnfs/drbd |
| 613 | VG Name vgnfs |
| 614 | LV UUID dNxdNj-hZCZ-GMrC-woMk-0hA2-f3oR-sBsrHI |
| 615 | LV Write Access read/write |
| 616 | LV Status NOT available |
| 617 | LV Size 1.50 GB |
| 618 | Current LE 48 |
| 619 | Segments 1 |
| 620 | Allocation inherit |
| 621 | Read ahead sectors 0 |
| 622 | |
| 623 | }}} |
| 624 | |
| 625 | ==== start md1 ==== |
| 626 | * root@Knoppix:~# mdadm -R /dev/md1 |
| 627 | {{{ |
| 628 | mdadm: started /dev/md1 |
| 629 | }}} |
| 630 | * root@Knoppix:~# cat /proc/mdstat |
| 631 | {{{ |
| 632 | Personalities : [raid1] |
| 633 | md1 : active raid1 sdb1[1] |
| 634 | 2047936 blocks [2/1] [_U] |
| 635 | |
| 636 | md0 : active raid1 sda1[0] |
| 637 | 2047936 blocks [2/1] [U_] |
| 638 | |
| 639 | unused devices: <none> |
| 640 | }}} |
| 641 | |
| 642 | ==== pvchange duplicate PV ==== |
| 643 | * root@Knoppix:~# pvscan |
| 644 | {{{ |
| 645 | Found duplicate PV Z2JXRPfa5gSYS5xzMsLq8C1JbhQPKihr: using /dev/md1 not /dev/md0 |
| 646 | PV /dev/md1 VG vgnfs lvm2 [1.94 GB / 1.94 GB free] |
| 647 | Total: 1 [1.94 GB] / in use: 1 [1.94 GB] / in no VG: 0 [0 ] |
| 648 | }}} |
| 649 | |
| 650 | * root@Knoppix:~# pvchange -u /dev/md1 |
| 651 | {{{ |
| 652 | Found duplicate PV Z2JXRPfa5gSYS5xzMsLq8C1JbhQPKihr: using /dev/md0 not /dev/md1 |
| 653 | Found duplicate PV Z2JXRPfa5gSYS5xzMsLq8C1JbhQPKihr: using /dev/md1 not /dev/md0 |
| 654 | Physical volume "/dev/md1" changed |
| 655 | 1 physical volume changed / 0 physical volumes not changed |
| 656 | }}} |
| 657 | |
| 658 | * root@Knoppix:~# mdadm -E /dev/sd[ab]1 |
| 659 | {{{ |
| 660 | /dev/sda1: |
| 661 | Magic : a92b4efc |
| 662 | Version : 00.90.00 |
| 663 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 664 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 665 | Raid Level : raid1 |
| 666 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 667 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 668 | Raid Devices : 2 |
| 669 | Total Devices : 1 |
| 670 | Preferred Minor : 0 |
| 671 | |
| 672 | Update Time : Fri Mar 25 15:28:34 2011 |
| 673 | State : clean |
| 674 | Active Devices : 1 |
| 675 | Working Devices : 1 |
| 676 | Failed Devices : 1 |
| 677 | Spare Devices : 0 |
| 678 | Checksum : e389914b - correct |
| 679 | Events : 0.36 |
| 680 | |
| 681 | |
| 682 | Number Major Minor RaidDevice State |
| 683 | this 0 8 17 0 active sync /dev/sdb1 |
| 684 | |
| 685 | 0 0 8 17 0 active sync /dev/sdb1 |
| 686 | 1 1 0 0 1 faulty removed |
| 687 | /dev/sdb1: |
| 688 | Magic : a92b4efc |
| 689 | Version : 00.90.00 |
| 690 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 691 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 692 | Raid Level : raid1 |
| 693 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 694 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 695 | Raid Devices : 2 |
| 696 | Total Devices : 1 |
| 697 | Preferred Minor : 1 |
| 698 | |
| 699 | Update Time : Fri Mar 25 16:58:00 2011 |
| 700 | State : clean |
| 701 | Active Devices : 1 |
| 702 | Working Devices : 1 |
| 703 | Failed Devices : 0 |
| 704 | Spare Devices : 0 |
| 705 | Checksum : e389a642 - correct |
| 706 | Events : 0.36 |
| 707 | |
| 708 | |
| 709 | Number Major Minor RaidDevice State |
| 710 | this 1 8 17 1 active sync /dev/sdb1 |
| 711 | |
| 712 | 0 0 0 0 0 removed |
| 713 | 1 1 8 17 1 active sync /dev/sdb1 |
| 714 | }}} |
| 715 | * /dev/sdb1 -> /dev/md1 の Events が 0.34 -> 0.36 と増加 |
| 716 | |
| 717 | ==== new Physical volume ==== |
| 718 | * UUIDを変更した場合、双方のPVが表示されるようになるが、VGは片方のみ表示される |
| 719 | |
| 720 | * root@Knoppix:~# pvdisplay /dev/md![01] |
| 721 | {{{ |
| 722 | --- Physical volume --- |
| 723 | PV Name /dev/md0 |
| 724 | VG Name vgnfs |
| 725 | PV Size 1.94 GB / not usable 0 |
| 726 | Allocatable yes |
| 727 | PE Size (KByte) 32768 |
| 728 | Total PE 62 |
| 729 | Free PE 14 |
| 730 | Allocated PE 48 |
| 731 | PV UUID Z2JXRP-fa5g-SYS5-xzMs-Lq8C-1Jbh-QPKihr |
| 732 | |
| 733 | --- NEW Physical volume --- |
| 734 | PV Name /dev/md1 |
| 735 | VG Name |
| 736 | PV Size 1.94 GB |
| 737 | Allocatable NO |
| 738 | PE Size (KByte) 0 |
| 739 | Total PE 0 |
| 740 | Free PE 0 |
| 741 | Allocated PE 0 |
| 742 | PV UUID A9rTHY-2IOl-mits-PiCZ-WZ5I-gQah-5265YU |
| 743 | |
| 744 | }}} |
| 745 | * root@Knoppix:~# vgdisplay |
| 746 | {{{ |
| 747 | --- Volume group --- |
| 748 | VG Name vgnfs |
| 749 | System ID |
| 750 | Format lvm2 |
| 751 | Metadata Areas 2 |
| 752 | Metadata Sequence No 2 |
| 753 | VG Access read/write |
| 754 | VG Status resizable |
| 755 | MAX LV 0 |
| 756 | Cur LV 1 |
| 757 | Open LV 0 |
| 758 | Max PV 0 |
| 759 | Cur PV 1 |
| 760 | Act PV 1 |
| 761 | VG Size 1.94 GB |
| 762 | PE Size 32.00 MB |
| 763 | Total PE 62 |
| 764 | Alloc PE / Size 48 / 1.50 GB |
| 765 | Free PE / Size 14 / 448.00 MB |
| 766 | VG UUID I6vVoh-6gCJ-9uvA-v2MV-Fyva-7J8v-Cvftfi |
| 767 | |
| 768 | }}} |
| 769 | |
| 770 | ==== stop md0 ==== |
| 771 | * /dev/md0 を止めることで、 /dev/md1 上のVGを表示出来る |
| 772 | |
| 773 | * root@Knoppix:~# mdadm --stop /dev/md0 |
| 774 | {{{ |
| 775 | mdadm: stopped /dev/md0 |
| 776 | }}} |
| 777 | |
| 778 | * root@Knoppix:~# pvdisplay /dev/md![01] |
| 779 | {{{ |
| 780 | No physical volume label read from /dev/md0 |
| 781 | Failed to read physical volume "/dev/md0" |
| 782 | --- Physical volume --- |
| 783 | PV Name /dev/md1 |
| 784 | VG Name vgnfs |
| 785 | PV Size 1.94 GB / not usable 0 |
| 786 | Allocatable yes |
| 787 | PE Size (KByte) 32768 |
| 788 | Total PE 62 |
| 789 | Free PE 62 |
| 790 | Allocated PE 0 |
| 791 | PV UUID A9rTHY-2IOl-mits-PiCZ-WZ5I-gQah-5265YU |
| 792 | |
| 793 | }}} |
| 794 | * root@Knoppix:~# vgdisplay |
| 795 | {{{ |
| 796 | --- Volume group --- |
| 797 | VG Name vgnfs |
| 798 | System ID |
| 799 | Format lvm2 |
| 800 | Metadata Areas 1 |
| 801 | Metadata Sequence No 2 |
| 802 | VG Access read/write |
| 803 | VG Status resizable |
| 804 | MAX LV 0 |
| 805 | Cur LV 0 |
| 806 | Open LV 0 |
| 807 | Max PV 0 |
| 808 | Cur PV 1 |
| 809 | Act PV 1 |
| 810 | VG Size 1.94 GB |
| 811 | PE Size 32.00 MB |
| 812 | Total PE 62 |
| 813 | Alloc PE / Size 0 / 0 |
| 814 | Free PE / Size 62 / 1.94 GB |
| 815 | VG UUID I6vVoh-6gCJ-9uvA-v2MV-Fyva-7J8v-Cvftfi |
| 816 | |
| 817 | }}} |
| 818 | * /dev/md1 はLVが作られていないので、PEが全てFreeのまま |
| 819 | |
| 820 | === re-assemble /dev/md0 with two device === |
| 821 | * [#assemblemd0andmd1] の過程で、PVのUUID等が不一致となったデバイスからRAID1を再構築する |
| 822 | |
| 823 | ==== stop md0 and md1 ==== |
| 824 | * root@Knoppix:~# mdadm --stop /dev/md0 |
| 825 | {{{ |
| 826 | mdadm: stopped /dev/md0 |
| 827 | }}} |
| 828 | * root@Knoppix:~# mdadm --stop /dev/md1 |
| 829 | {{{ |
| 830 | mdadm: stopped /dev/md1 |
| 831 | }}} |
| 832 | |
| 833 | * root@Knoppix:~# cat /proc/mdstat |
| 834 | {{{ |
| 835 | Personalities : [raid1] |
| 836 | unused devices: <none> |
| 837 | }}} |
| 838 | |
| 839 | ==== mdadm status ==== |
| 840 | * root@Knoppix:~# mdadm -E /dev/sd[ab]1 |
| 841 | {{{ |
| 842 | /dev/sda1: |
| 843 | Magic : a92b4efc |
| 844 | Version : 00.90.00 |
| 845 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 846 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 847 | Raid Level : raid1 |
| 848 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 849 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 850 | Raid Devices : 2 |
| 851 | Total Devices : 1 |
| 852 | Preferred Minor : 0 |
| 853 | |
| 854 | Update Time : Fri Mar 25 15:28:34 2011 |
| 855 | State : clean |
| 856 | Active Devices : 1 |
| 857 | Working Devices : 1 |
| 858 | Failed Devices : 1 |
| 859 | Spare Devices : 0 |
| 860 | Checksum : e389914b - correct |
| 861 | Events : 0.36 |
| 862 | |
| 863 | |
| 864 | Number Major Minor RaidDevice State |
| 865 | this 0 8 17 0 active sync /dev/sdb1 |
| 866 | |
| 867 | 0 0 8 17 0 active sync /dev/sdb1 |
| 868 | 1 1 0 0 1 faulty removed |
| 869 | /dev/sdb1: |
| 870 | Magic : a92b4efc |
| 871 | Version : 00.90.00 |
| 872 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 873 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 874 | Raid Level : raid1 |
| 875 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 876 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 877 | Raid Devices : 2 |
| 878 | Total Devices : 1 |
| 879 | Preferred Minor : 1 |
| 880 | |
| 881 | Update Time : Fri Mar 25 16:58:00 2011 |
| 882 | State : clean |
| 883 | Active Devices : 1 |
| 884 | Working Devices : 1 |
| 885 | Failed Devices : 0 |
| 886 | Spare Devices : 0 |
| 887 | Checksum : e389a642 - correct |
| 888 | Events : 0.36 |
| 889 | |
| 890 | |
| 891 | Number Major Minor RaidDevice State |
| 892 | this 1 8 17 1 active sync /dev/sdb1 |
| 893 | |
| 894 | 0 0 0 0 0 removed |
| 895 | 1 1 8 17 1 active sync /dev/sdb1 |
| 896 | }}} |
| 897 | |
| 898 | ==== assemble /dev/md0 ==== |
| 899 | * root@Knoppix:~# mdadm -A /dev/md0 /dev/sd[ab]1 |
| 900 | {{{ |
| 901 | mdadm: device 1 in /dev/md0 has wrong state in superblock, but /dev/sdb1 seems ok |
| 902 | mdadm: failed to add /dev/sda1 to /dev/md0: Invalid argument |
| 903 | mdadm: /dev/md0 has been started with 1 drive (out of 2). |
| 904 | }}} |
| 905 | * root@Knoppix:~# mdadm -A /dev/md0 -u 32578407:6f33f50b:893cf340:745f5dce |
| 906 | {{{ |
| 907 | mdadm: device 1 in /dev/md0 has wrong state in superblock, but /dev/sdb1 seems ok |
| 908 | mdadm: failed to add /dev/sda1 to /dev/md0: Invalid argument |
| 909 | mdadm: /dev/md0 has been started with 1 drive (out of 2). |
| 910 | }}} |
| 911 | * root@Knoppix:~# cat /proc/mdstat |
| 912 | {{{ |
| 913 | Personalities : [raid1] |
| 914 | md0 : active raid1 sdb1[1] |
| 915 | 2047936 blocks [2/1] [_U] |
| 916 | |
| 917 | unused devices: <none> |
| 918 | }}} |
| 919 | |
| 920 | * Update Time がより新しい /dev/sdb1 から /dev/md0 が構成されてしまう |
| 921 | |
| 922 | * root@Knoppix:~# lvdisplay -C |
| 923 | * no output |
| 924 | |
| 925 | ==== assemble /dev/md0 with /dev/sda1 ==== |
| 926 | * 明示的に /dev/sda1 から /dev/md0 を再構成する |
| 927 | |
| 928 | * root@Knoppix:~# mdadm -A /dev/md0 /dev/sda1 |
| 929 | {{{ |
| 930 | mdadm: /dev/md0 has been started with 1 drive (out of 2). |
| 931 | }}} |
| 932 | * root@Knoppix:~# cat /proc/mdstat |
| 933 | {{{ |
| 934 | Personalities : [raid1] |
| 935 | md0 : active raid1 sda1[0] |
| 936 | 2047936 blocks [2/1] [U_] |
| 937 | |
| 938 | unused devices: <none> |
| 939 | }}} |
| 940 | |
| 941 | * root@Knoppix:~# lvdisplay -C |
| 942 | {{{ |
| 943 | LV VG Attr LSize Origin Snap% Move Log Copy% |
| 944 | drbd vgnfs -wi--- 1.50G |
| 945 | }}} |
| 946 | * LVの drbd が復活する |
| 947 | |
| 948 | ==== re-add /dev/sdb1 to /dev/md0 ==== |
| 949 | * root@Knoppix:~# mdadm /dev/md0 -a /dev/sdb1 |
| 950 | {{{ |
| 951 | mdadm: re-added /dev/sdb1 |
| 952 | }}} |
| 953 | |
| 954 | * root@Knoppix:~# cat /proc/mdstat |
| 955 | {{{ |
| 956 | Personalities : [raid1] |
| 957 | md0 : active raid1 sdb1[1] sda1[0] |
| 958 | 2047936 blocks [2/2] [UU] |
| 959 | |
| 960 | unused devices: <none> |
| 961 | }}} |
| 962 | * root@Knoppix:~# dmesg | tail -n 20 |
| 963 | {{{ |
| 964 | RAID1 conf printout: |
| 965 | --- wd:1 rd:2 |
| 966 | disk 0, wo:0, o:1, dev:sda1 |
| 967 | disk 1, wo:1, o:1, dev:sdb1 |
| 968 | md: recovery of RAID array md0 |
| 969 | md: minimum _guaranteed_ speed: 1000 KB/sec/disk. |
| 970 | md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for recovery. |
| 971 | md: using 128k window, over a total of 2047936 blocks. |
| 972 | md: md0: recovery done. |
| 973 | RAID1 conf printout: |
| 974 | --- wd:2 rd:2 |
| 975 | disk 0, wo:0, o:1, dev:sda1 |
| 976 | disk 1, wo:0, o:1, dev:sdb1 |
| 977 | }}} |
| 978 | |
| 979 | * root@Knoppix:~# mdadm -E /dev/sd[ab]1 |
| 980 | {{{ |
| 981 | /dev/sda1: |
| 982 | Magic : a92b4efc |
| 983 | Version : 00.90.00 |
| 984 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 985 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 986 | Raid Level : raid1 |
| 987 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 988 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 989 | Raid Devices : 2 |
| 990 | Total Devices : 2 |
| 991 | Preferred Minor : 0 |
| 992 | |
| 993 | Update Time : Fri Mar 25 17:13:19 2011 |
| 994 | State : clean |
| 995 | Active Devices : 2 |
| 996 | Working Devices : 2 |
| 997 | Failed Devices : 0 |
| 998 | Spare Devices : 0 |
| 999 | Checksum : e389a9dc - correct |
| 1000 | Events : 0.42 |
| 1001 | |
| 1002 | |
| 1003 | Number Major Minor RaidDevice State |
| 1004 | this 0 8 1 0 active sync /dev/sda1 |
| 1005 | |
| 1006 | 0 0 8 1 0 active sync /dev/sda1 |
| 1007 | 1 1 8 17 1 active sync /dev/sdb1 |
| 1008 | /dev/sdb1: |
| 1009 | Magic : a92b4efc |
| 1010 | Version : 00.90.00 |
| 1011 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 1012 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 1013 | Raid Level : raid1 |
| 1014 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 1015 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 1016 | Raid Devices : 2 |
| 1017 | Total Devices : 2 |
| 1018 | Preferred Minor : 0 |
| 1019 | |
| 1020 | Update Time : Fri Mar 25 17:13:19 2011 |
| 1021 | State : clean |
| 1022 | Active Devices : 2 |
| 1023 | Working Devices : 2 |
| 1024 | Failed Devices : 0 |
| 1025 | Spare Devices : 0 |
| 1026 | Checksum : e389a9ee - correct |
| 1027 | Events : 0.42 |
| 1028 | |
| 1029 | |
| 1030 | Number Major Minor RaidDevice State |
| 1031 | this 1 8 17 1 active sync /dev/sdb1 |
| 1032 | |
| 1033 | 0 0 8 1 0 active sync /dev/sda1 |
| 1034 | 1 1 8 17 1 active sync /dev/sdb1 |
| 1035 | }}} |
| 1036 | * Events がさらに増加して 0.42 となる |
| 1037 | |
| 1038 | ==== something wrong on PV on RAID1 ==== |
| 1039 | * /dev/sda1 と /dev/sdb1 が同期されたように見えて、実際にはされていない? |
| 1040 | |
| 1041 | * root@Knoppix:~# mdadm --stop /dev/md0 |
| 1042 | {{{ |
| 1043 | mdadm: stopped /dev/md0 |
| 1044 | }}} |
| 1045 | * root@Knoppix:~# mdadm -A /dev/md0 -u 32578407:6f33f50b:893cf340:745f5dce |
| 1046 | {{{ |
| 1047 | mdadm: /dev/md0 has been started with 2 drives. |
| 1048 | }}} |
| 1049 | |
| 1050 | * root@Knoppix:~# pvdisplay |
| 1051 | {{{ |
| 1052 | get_pv_from_vg_by_id: vg_read failed to read VG |
| 1053 | --- NEW Physical volume --- |
| 1054 | PV Name /dev/md0 |
| 1055 | VG Name |
| 1056 | PV Size 1.95 GB |
| 1057 | Allocatable NO |
| 1058 | PE Size (KByte) 0 |
| 1059 | Total PE 0 |
| 1060 | Free PE 0 |
| 1061 | Allocated PE 0 |
| 1062 | PV UUID Z2JXRP-fa5g-SYS5-xzMs-Lq8C-1Jbh-QPKihr |
| 1063 | |
| 1064 | }}} |
| 1065 | |
| 1066 | ==== correct PV with degraded RAID1 ==== |
| 1067 | * root@Knoppix:~# mdadm --stop /dev/md0 |
| 1068 | {{{ |
| 1069 | mdadm: stopped /dev/md0 |
| 1070 | }}} |
| 1071 | * root@Knoppix:~# mdadm -A /dev/md0 /dev/sda1 --run |
| 1072 | {{{ |
| 1073 | mdadm: /dev/md0 has been started with 1 drive (out of 2). |
| 1074 | }}} |
| 1075 | * root@Knoppix:~# pvdisplay /dev/md0 |
| 1076 | {{{ |
| 1077 | --- Physical volume --- |
| 1078 | PV Name /dev/md0 |
| 1079 | VG Name vgnfs |
| 1080 | PV Size 1.94 GB / not usable 0 |
| 1081 | Allocatable yes |
| 1082 | PE Size (KByte) 32768 |
| 1083 | Total PE 62 |
| 1084 | Free PE 14 |
| 1085 | Allocated PE 48 |
| 1086 | PV UUID Z2JXRP-fa5g-SYS5-xzMs-Lq8C-1Jbh-QPKihr |
| 1087 | |
| 1088 | }}} |
| 1089 | |
| 1090 | ==== PV goes wrong when re-add /dev/sdb1 ==== |
| 1091 | * root@Knoppix:~# mdadm /dev/md0 -a /dev/sdb1 |
| 1092 | {{{ |
| 1093 | mdadm: re-added /dev/sdb1 |
| 1094 | }}} |
| 1095 | * root@Knoppix:~# pvdisplay /dev/md0 |
| 1096 | {{{ |
| 1097 | get_pv_from_vg_by_id: vg_read failed to read VG |
| 1098 | --- NEW Physical volume --- |
| 1099 | PV Name /dev/md0 |
| 1100 | VG Name |
| 1101 | PV Size 1.94 GB |
| 1102 | Allocatable NO |
| 1103 | PE Size (KByte) 0 |
| 1104 | Total PE 0 |
| 1105 | Free PE 0 |
| 1106 | Allocated PE 0 |
| 1107 | PV UUID A9rTHY-2IOl-mits-PiCZ-WZ5I-gQah-5265YU |
| 1108 | |
| 1109 | }}} |
| 1110 | |
| 1111 | * PV UUID が変化してしまっている |
| 1112 | * LVMのmetadataが不整合になっている模様 |
| 1113 | |
| 1114 | * root@Knoppix:~# mdadm -E /dev/sd[ab]1 | grep Event |
| 1115 | {{{ |
| 1116 | Events : 0.48 |
| 1117 | Events : 0.48 |
| 1118 | }}} |
| 1119 | |
| 1120 | ==== erase superblock of sdb1 ==== |
| 1121 | * root@Knoppix:~# mdadm --stop /dev/md0 |
| 1122 | {{{ |
| 1123 | mdadm: stopped /dev/md0 |
| 1124 | }}} |
| 1125 | * root@Knoppix:~# mdadm --zero-superblock /dev/sdb1 |
| 1126 | * root@Knoppix:~# mdadm -A /dev/md0 -u 32578407:6f33f50b:893cf340:745f5dce |
| 1127 | {{{ |
| 1128 | mdadm: /dev/md0 has been started with 1 drive (out of 2). |
| 1129 | }}} |
| 1130 | |
| 1131 | * root@Knoppix:~# lvdisplay -C |
| 1132 | {{{ |
| 1133 | LV VG Attr LSize Origin Snap% Move Log Copy% |
| 1134 | drbd vgnfs -wi--- 1.50G |
| 1135 | }}} |
| 1136 | |
| 1137 | ==== rebuilding /dev/md0 ==== |
| 1138 | * root@Knoppix:~# mdadm /dev/md0 -a /dev/sdb1 |
| 1139 | {{{ |
| 1140 | mdadm: added /dev/sdb1 |
| 1141 | }}} |
| 1142 | * root@Knoppix:~# cat /proc/mdstat |
| 1143 | {{{ |
| 1144 | Personalities : [raid1] |
| 1145 | md0 : active raid1 sdb1[2] sda1[0] |
| 1146 | 2047936 blocks [2/1] [U_] |
| 1147 | [================>....] recovery = 84.7% (1735936/2047936) finish=0.0min speed=96440K/sec |
| 1148 | |
| 1149 | unused devices: <none> |
| 1150 | }}} |
| 1151 | |
| 1152 | * root@Knoppix:~# mdadm -E /dev/sd[ab]1 |
| 1153 | {{{ |
| 1154 | /dev/sda1: |
| 1155 | Magic : a92b4efc |
| 1156 | Version : 00.90.00 |
| 1157 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 1158 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 1159 | Raid Level : raid1 |
| 1160 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 1161 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 1162 | Raid Devices : 2 |
| 1163 | Total Devices : 2 |
| 1164 | Preferred Minor : 0 |
| 1165 | |
| 1166 | Update Time : Fri Mar 25 17:36:17 2011 |
| 1167 | State : clean |
| 1168 | Active Devices : 2 |
| 1169 | Working Devices : 2 |
| 1170 | Failed Devices : 0 |
| 1171 | Spare Devices : 0 |
| 1172 | Checksum : e389af56 - correct |
| 1173 | Events : 0.54 |
| 1174 | |
| 1175 | |
| 1176 | Number Major Minor RaidDevice State |
| 1177 | this 0 8 1 0 active sync /dev/sda1 |
| 1178 | |
| 1179 | 0 0 8 1 0 active sync /dev/sda1 |
| 1180 | 1 1 8 17 1 active sync /dev/sdb1 |
| 1181 | /dev/sdb1: |
| 1182 | Magic : a92b4efc |
| 1183 | Version : 00.90.00 |
| 1184 | UUID : 32578407:6f33f50b:893cf340:745f5dce |
| 1185 | Creation Time : Thu Mar 24 17:31:36 2011 |
| 1186 | Raid Level : raid1 |
| 1187 | Used Dev Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 1188 | Array Size : 2047936 (2000.27 MiB 2097.09 MB) |
| 1189 | Raid Devices : 2 |
| 1190 | Total Devices : 2 |
| 1191 | Preferred Minor : 0 |
| 1192 | |
| 1193 | Update Time : Fri Mar 25 17:36:17 2011 |
| 1194 | State : clean |
| 1195 | Active Devices : 2 |
| 1196 | Working Devices : 2 |
| 1197 | Failed Devices : 0 |
| 1198 | Spare Devices : 0 |
| 1199 | Checksum : e389af68 - correct |
| 1200 | Events : 0.54 |
| 1201 | |
| 1202 | |
| 1203 | Number Major Minor RaidDevice State |
| 1204 | this 1 8 17 1 active sync /dev/sdb1 |
| 1205 | |
| 1206 | 0 0 8 1 0 active sync /dev/sda1 |
| 1207 | 1 1 8 17 1 active sync /dev/sdb1 |
| 1208 | }}} |
| 1209 | |
| 1210 | === result === |
| 1211 | * root@Knoppix:~# pvdisplay |
| 1212 | {{{ |
| 1213 | --- Physical volume --- |
| 1214 | PV Name /dev/md0 |
| 1215 | VG Name vgnfs |
| 1216 | PV Size 1.94 GB / not usable 0 |
| 1217 | Allocatable yes |
| 1218 | PE Size (KByte) 32768 |
| 1219 | Total PE 62 |
| 1220 | Free PE 14 |
| 1221 | Allocated PE 48 |
| 1222 | PV UUID Z2JXRP-fa5g-SYS5-xzMs-Lq8C-1Jbh-QPKihr |
| 1223 | |
| 1224 | }}} |