+ Responder ao Tópico



  1. #1
    fabricio_
    Visitante

    Padrão Raid 1 sem formatar

    Estou precisando fazer um raid 1 sem ter que formatar a maquina .
    Assim , a maquina esta com uma aplicação rodando , com apenas 1 hd . Estou para instalar seu segundo HD e fazer um mirror , onde neste mirror esteja os dados do primeiro HD .
    Como devo proceder ?
    Sei que tem como , nao quero ter o trabalho de fazer um clone do hd , depois fazer tudo do zero , depois restaurar um clone.

  2. #2
    Visitante

    Padrão Raid 1 sem formatar

    Para criar o RAID você vai ter de alterar o tipo de partição com o fdisk. de 83 (Linux) para FD (Raid Auto detect). Logo você deve tirar um backup dos dados e refazer a instalação sim. Obs.: Se o raid for via hardware talvez funcione só plugando outro disco e criando a raid, mas mesmo assim é recomendável o backup.

  3. #3
    fabricio_
    Visitante

    Padrão Raid 1 sem formatar

    ok vou tentar na minha maquina de testes .
    Precisa disso pronto para amanha ...
    Sera que nao da problema em particoes que sao LVM , digo mudar o formato para LINUX RAID ?

  4. #4
    rodrigopc-rj
    Visitante

    Padrão Raid 1 sem formatar

    é possível sim!
    eu mesmo já fiz em + de 10 servidores em produção e nunca tive problemas no processo...

    Coisas importantes:
    1 - vc deve instalar o pacote de gerenciamento de raid, seja o raidtools ou o mdadm.
    2 - se o seu kernel for compilado, verifique se o raid a ser utilizado está intrince, caso esteja como módulo vc deve ter o initrd.

    falarei sobre o raidtools...
    o procediento:

    como já foi falado, vc terá que modificar o typo da partição:

    Vc precisará dar um boot com cd, se o seu kernel for o 2.4 aconcelho o slackware, caso seja o 2.6, o knoppix.

    dê um boot com o cd
    # fdisk /dev/hda (1º disco)
    t (para mudar o tipo)
    1 (o número da partição)

    Faça isso para todas as partições, mesmo a de swap (se vc quizer, pois pode fazer raid 0, para melhorar a performance.

    faça isso também para o 2º disco... as partições devem ser idênticas
    exemplo de 2 partições:
    crie o arquivo /etc/raidtab
    raiddev /dev/md0
    raid-level 1
    nr-raid-disks 2
    nr-spare-disks 0
    chunk-size 4
    persistent-superblock 1
    device /dev/hda2
    raid-disk 0
    device /dev/hdc2
    raid-disk 1
    device /dev/hdd2

    raiddev /dev/md1
    raid-level 1
    nr-raid-disks 2
    nr-spare-disks 0
    chunk-size 4
    persistent-superblock 1
    device /dev/hda3
    raid-disk 0
    device /dev/hdc3
    raid-disk 1
    device /dev/hdd3

    # mkraid /dev/md0
    # mkraid /dev/md1
    # ...
    para verificar o progresso:
    # cat /proc/mdstat

    devida a mudaça do tipo de partição, o tamanho físico difere do lógico, então deve ser executado o seguinte comando:
    # resize2fs --really-force /dev/md0
    # resize2fs --really-force /dev/md1 (menos para a partição de SWAP)
    # ...

    a estutura /, /boot e /etc deve estar montada abaixo de /mnt do sistema de arquivo virtual do cd de boot

    # mount /dev/md0 /mnt (se esta partição for o /)
    # mount /dev/md1 /mnt/boot (se esta partição for o /boot)
    note que a montagem deve levar em conta como foi particionado o seu hd.
    # cp /etc/raidtab /mnt/etc/
    # vi /mnt/etc/fstab (troque todas as referências aos dispositivos do tipo hda, hdb, para md)
    # vi /mnt/etc/lilo.conf (a mesma coisa)
    insira também a linha:
    raid-extra-boot=/dev/hda,/dev/hdc (para no caso de falha de um disco, o boot ser feito por outro)
    # lilo -r /mnt -C /mnt/etc/lilo.conf (para carregar na MBR)
    # mkswap /dev/mdX (a partição de SWAP)

    reinicie e seja feliz...

  5. #5

    Padrão Raid 1 sem formatar

    Citação Postado originalmente por rodrigopc-rj
    é possível sim!
    eu mesmo já fiz em + de 10 servidores em produção e nunca tive problemas no processo...

    Coisas importantes:
    1 - vc deve instalar o pacote de gerenciamento de raid, seja o raidtools ou o mdadm.
    2 - se o seu kernel for compilado, verifique se o raid a ser utilizado está intrince, caso esteja como módulo vc deve ter o initrd.

    falarei sobre o raidtools...
    o procediento:

    como já foi falado, vc terá que modificar o typo da partição:

    Vc precisará dar um boot com cd, se o seu kernel for o 2.4 aconcelho o slackware, caso seja o 2.6, o knoppix.

    dê um boot com o cd
    # fdisk /dev/hda (1º disco)
    t (para mudar o tipo)
    1 (o número da partição)

    Faça isso para todas as partições, mesmo a de swap (se vc quizer, pois pode fazer raid 0, para melhorar a performance.

    faça isso também para o 2º disco... as partições devem ser idênticas
    exemplo de 2 partições:
    crie o arquivo /etc/raidtab
    raiddev /dev/md0
    raid-level 1
    nr-raid-disks 2
    nr-spare-disks 0
    chunk-size 4
    persistent-superblock 1
    device /dev/hda2
    raid-disk 0
    device /dev/hdc2
    raid-disk 1
    device /dev/hdd2

    raiddev /dev/md1
    raid-level 1
    nr-raid-disks 2
    nr-spare-disks 0
    chunk-size 4
    persistent-superblock 1
    device /dev/hda3
    raid-disk 0
    device /dev/hdc3
    raid-disk 1
    device /dev/hdd3

    # mkraid /dev/md0
    # mkraid /dev/md1
    # ...
    para verificar o progresso:
    # cat /proc/mdstat

    devida a mudaça do tipo de partição, o tamanho físico difere do lógico, então deve ser executado o seguinte comando:
    # resize2fs --really-force /dev/md0
    # resize2fs --really-force /dev/md1 (menos para a partição de SWAP)
    # ...

    a estutura /, /boot e /etc deve estar montada abaixo de /mnt do sistema de arquivo virtual do cd de boot

    # mount /dev/md0 /mnt (se esta partição for o /)
    # mount /dev/md1 /mnt/boot (se esta partição for o /boot)
    note que a montagem deve levar em conta como foi particionado o seu hd.
    # cp /etc/raidtab /mnt/etc/
    # vi /mnt/etc/fstab (troque todas as referências aos dispositivos do tipo hda, hdb, para md)
    # vi /mnt/etc/lilo.conf (a mesma coisa)
    insira também a linha:
    raid-extra-boot=/dev/hda,/dev/hdc (para no caso de falha de um disco, o boot ser feito por outro)
    # lilo -r /mnt -C /mnt/etc/lilo.conf (para carregar na MBR)
    # mkswap /dev/mdX (a partição de SWAP)

    reinicie e seja feliz...
    Cara otimo tutorial se desse pra voce dar uma melhorada e explicar um pouco melhor cada passo e por no wiki ia ser uma otima.
    under-linux.org/wiki
    falows

  6. #6
    fabricio_
    Visitante

    Padrão Raid 1 sem formatar

    mto obrigado
    amanha eu vou fazer o teste e posto aqui caso ocorra algum problema

    só uma duvida , eu vou ter 2 partições no array , como o mdadm sabe de qual preservar os dados ?? pela ordem do raidtab ??

  7. #7
    rodrigopc-rj
    Visitante

    Padrão Raid 1 sem formatar

    Citação Postado originalmente por fabricio_
    mto obrigado
    amanha eu vou fazer o teste e posto aqui caso ocorra algum problema

    só uma duvida , eu vou ter 2 partições no array , como o mdadm sabe de qual preservar os dados ?? pela ordem do raidtab ??
    o mdadm utiliza um formato diferente de configuração... o que eu postei é com o raidtools. O procedimento é exatamente o mesmo, porém será com o arquivo do mdadm e não com o /etc/raidtab...

    cada partição em cada disco formará um array:
    /dev/hda1 e /dev/hdc1 = /dev/md0

    a ordem é importante, pois definirá qual partição será replicada
    {
    device /dev/hda3
    raid-disk 0
    device /dev/hdc3
    raid-disk 1
    }
    isso significa que a partição /dev/hda3 será replicada para /dev/hdc3

  8. #8
    fabricio_
    Visitante

    Padrão Raid 1 sem formatar

    é raidtools mesmo , soh me confundi rlx
    bom vou testar agorinha , e vou postando como esta indo
    se der certo , no final eu posto um how to

  9. #9
    fabricio_
    Visitante

    Padrão Raid 1 sem formatar

    bom , fiz um teste usando o mdadm , nao deu mto certo
    estou tentando fazer numa maquina fedora core 4 , com o disco rescue do fedora 4 tb.
    a sintaxe que usei no mdadm foi
    Código :
    mdadm --create /dev/md0 --raid-devices=2 --level=1 /dev/hda1 /dev/hda3

    ele faz o raid normal , FIz um gru-install /dev/md0 e nao me retornou nenhum erro ,
    Na hora de bootar , ele bootou pelo hda1 e o raid tava sem o hda3 , nao consegui subir ele de jeito nenhum
    segue a saida do meu dmesg
    Código :
    Linux version 2.6.11-1.1369_FC4 ([email protected]) (gcc version 4.0.0 20050525 (Red Hat 4.0.0-9)) #1 Thu Jun 2 22:55:56 EDT 2005
    BIOS-provided physical RAM map:
     BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)
     BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
     BIOS-e820: 0000000000100000 - 0000000007eae000 (usable)
     BIOS-e820: 0000000007eae000 - 0000000008000000 (reserved)
     BIOS-e820: 00000000ffb00000 - 0000000100000000 (reserved)
    0MB HIGHMEM available.
    126MB LOWMEM available.
    Using x86 segment limits to approximate NX protection
    On node 0 totalpages: 32430
      DMA zone: 4096 pages, LIFO batch:1
      Normal zone: 28334 pages, LIFO batch:15
      HighMem zone: 0 pages, LIFO batch:1
    DMI 2.3 present.
    ACPI: RSDP (v000 DELL                                  ) @ 0x000fd790
    ACPI: RSDT (v001 DELL    GX100   0x00000007 ASL  0x00000061) @ 0x000fd7a4
    ACPI: FADT (v001 DELL    GX100   0x00000007 ASL  0x00000061) @ 0x000fd7cc
    ACPI: DSDT (v001   DELL    dt_ex 0x00001000 MSFT 0x0100000b) @ 0x00000000
    ACPI: PM-Timer IO Port: 0x808
    Allocating PCI resources starting at 08000000 (gap: 08000000:f7b00000)
    Built 1 zonelists
    Kernel command line: ro root=LABEL=/
    Initializing CPU#0
    CPU 0 irqstacks, hard=c0457000 soft=c0456000
    PID hash table entries: 1024 (order: 10, 16384 bytes)
    Detected 595.137 MHz processor.
    Using pmtmr for high-res timesource
    Console: colour VGA+ 80x25
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 123180k/129720k available (2518k kernel code, 6024k reserved, 690k data, 180k init, 0k highmem)
    Checking if this processor honours the WP bit even in supervisor mode... Ok.
    Calibrating delay loop... 1175.55 BogoMIPS (lpj=587776)
    Security Framework v1.0.0 initialized
    SELinux:  Initializing.
    SELinux:  Starting in permissive mode
    selinux_register_security:  Registering secondary module capability
    Capability LSM initialized as secondary
    Mount-cache hash table entries: 512
    CPU: After generic identify, caps: 0383f9ff 00000000 00000000 00000000 00000000 00000000 00000000
    CPU: After vendor identify, caps: 0383f9ff 00000000 00000000 00000000 00000000 00000000 00000000
    CPU: L1 I cache: 16K, L1 D cache: 16K
    CPU: L2 cache: 128K
    CPU: After all inits, caps: 0383f1ff 00000000 00000000 00000040 00000000 00000000 00000000
    Intel machine check architecture supported.
    Intel machine check reporting enabled on CPU#0.
    CPU: Intel Celeron (Coppermine) stepping 06
    Enabling fast FPU save and restore... done.
    Enabling unmasked SIMD FPU exception support... done.
    Checking 'hlt' instruction... OK.
    ACPI: setting ELCR to 0200 (from 0e20)
    checking if image is initramfs... it is
    softlockup thread 0 started up.
    Freeing initrd memory: 1108k freed
    NET: Registered protocol family 16
    PCI: PCI BIOS revision 2.10 entry at 0xfc0be, last bus=1
    PCI: Using configuration type 1
    mtrr: v2.0 (20020519)
    ACPI: Subsystem revision 20050309
    ACPI: Interpreter enabled
    ACPI: Using PIC for interrupt routing
    ACPI: PCI Root Bridge [PCI0] (0000:00)
    PCI: Probing PCI hardware (bus 00)
    Boot video device is 0000:00:01.0
    PCI: Transparent bridge - 0000:00:1e.0
    ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
    ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCI1._PRT]
    ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 *9 10 11 12 15)
    ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 *10 11 12 15)
    ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 *5 6 7 9 10 11 12 15)
    ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11 12 15)
    Linux Plug and Play Support v0.97 (c) Adam Belay
    pnp: PnP ACPI init
    pnp: PnP ACPI: found 12 devices
    usbcore: registered new driver usbfs
    usbcore: registered new driver hub
    PCI: Using ACPI for IRQ routing
    PCI: If a device doesn't work, try "pci=routeirq".  If it helps, post a report
    pnp: 00:0b: ioport range 0x800-0x85f could not be reserved
    pnp: 00:0b: ioport range 0xc00-0xc7f has been reserved
    pnp: 00:0b: ioport range 0x860-0x8ff could not be reserved
    apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16ac)
    apm: overridden by ACPI.
    audit: initializing netlink socket (disabled)
    audit(1133438923.414:1): initialized
    Total HugeTLB memory allocated, 0
    VFS: Disk quotas dquot_6.5.1
    Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    SELinux:  Registering netfilter hooks
    Initializing Cryptographic API
    ksign: Installing public key data
    Loading keyring
    - Added public key 42BD35A990375F72
    - User ID: Red Hat, Inc. (Kernel Module GPG key)
    pci_hotplug: PCI Hot Plug PCI Core version: 0.5
    isapnp: Scanning for PnP cards...
    isapnp: No Plug & Play device found
    Real Time Clock Driver v1.12
    Linux agpgart interface v0.101 (c) Dave Jones
    agpgart: Detected an Intel i810 DC100 Chipset.
    agpgart: detected 4MB dedicated video ram.
    agpgart: AGP aperture is 64M @ 0xf8000000
    PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
    serio: i8042 AUX port at 0x60,0x64 irq 12
    serio: i8042 KBD port at 0x60,0x64 irq 1
    Serial: 8250/16550 driver $Revision: 1.90 $ 76 ports, IRQ sharing enabled
    ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
    ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
    ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
    ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
    io scheduler noop registered
    io scheduler anticipatory registered
    io scheduler deadline registered
    io scheduler cfq registered
    RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
    Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
    ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
    ICH: IDE controller at PCI slot 0000:00:1f.1
    ICH: chipset revision 2
    ICH: not 100% native mode: will probe irqs later
        ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio
        ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:pio
    Probing IDE interface ide0...
    hda: Maxtor 90651U2, ATA DISK drive
    ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
    Probing IDE interface ide1...
    hdc: SAMSUNG CD-ROM SC-148F, ATAPI CD/DVD-ROM drive
    ide1 at 0x170-0x177,0x376 on irq 15
    hda: max request size: 128KiB
    hda: 12594960 sectors (6448 MB) w/512KiB Cache, CHS=12495/16/63, UDMA(66)
    hda: cache flushes not supported
     hda: hda1 hda2 hda3 hda4 < hda5 >
    hdc: ATAPI 48X CD-ROM drive, 128kB Cache, UDMA(33)
    Uniform CD-ROM driver Revision: 3.20
    ide-floppy driver 0.99.newide
    usbcore: registered new driver hiddev
    usbcore: registered new driver usbhid
    drivers/usb/input/hid-core.c: v2.01:USB HID core driver
    mice: PS/2 mouse device common for all mice
    md: md driver 0.90.1 MAX_MD_DEVS=256, MD_SB_DISKS=27
    NET: Registered protocol family 2
    IP: routing cache hash table of 128 buckets, 4Kbytes
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 4, 114688 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    Initializing IPsec netlink socket
    NET: Registered protocol family 1
    NET: Registered protocol family 17
    ACPI wakeup devices: 
    PCI0 USB0 PCI1  KBD 
    ACPI: (supports S0 S1 S4 S5)
    Freeing unused kernel memory: 180k freed
    input: AT Translated Set 2 keyboard on isa0060/serio0
    device-mapper: 4.4.0-ioctl (2005-01-12) initialised: [email][email protected][/email]
    EXT3-fs: INFO: recovery required on readonly filesystem.
    EXT3-fs: write access will be enabled during recovery.
    kjournald starting.  Commit interval 5 seconds
    EXT3-fs: recovery complete.
    EXT3-fs: mounted filesystem with ordered data mode.
    SELinux:  Disabled at runtime.
    SELinux:  Unregistering netfilter hooks
    Floppy drive(s): fd0 is 1.44M
    FDC 0 is a National Semiconductor PC87306
    ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 5
    PCI: setting IRQ 5 as level-triggered
    ACPI: PCI Interrupt 0000:01:0c.0[A] -> Link [LNKC] -> GSI 5 (level, low) -> IRQ 5
    3c59x: Donald Becker and others. [url]www.scyld.com/network/vortex.html[/url]
    0000:01:0c.0: 3Com PCI 3c905C Tornado at 0xec80. Vers LK1.1.19
    i801_smbus 0000:00:1f.3: enabling SMBus device
    hw_random hardware driver 1.0.0 loaded
    USB Universal Host Controller Interface driver v2.2
    ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
    PCI: setting IRQ 11 as level-triggered
    ACPI: PCI Interrupt 0000:00:1f.2[D] -> Link [LNKD] -> GSI 11 (level, low) -> IRQ 11
    PCI: Setting latency timer of device 0000:00:1f.2 to 64
    uhci_hcd 0000:00:1f.2: UHCI Host Controller
    uhci_hcd 0000:00:1f.2: new USB bus registered, assigned bus number 1
    uhci_hcd 0000:00:1f.2: irq 11, io base 0x0000ff80
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 2 ports detected
    ACPI: Power Button (FF) [PWRF]
    ibm_acpi: ec object not found
    md: Autodetecting RAID arrays.
    md: could not bd_claim hda1.
    md: autorun ...
    md: considering hda5 ...
    md:  adding hda5 ...
    md: hda3 has different UUID to hda5
    md:  adding hda2 ...
    md: created md1
    md: bind<hda2>
    md1: WARNING: hda5 appears to be on the same physical disk as hda2. True
         protection against single-disk failure might be compromised.
    md: bind<hda5>
    md: running: <hda5><hda2>
    md: raid1 personality registered as nr 3
    raid1: raid set md1 active with 2 out of 2 mirrors
    md: considering hda3 ...
    md:  adding hda3 ...
    md: created md0
    md: bind<hda3>
    md: running: <hda3>
    raid1: raid set md0 active with 1 out of 2 mirrors
    md: ... autorun DONE.
    EXT3 FS on hda1, internal journal
    ACPI: PCI Interrupt 0000:01:0c.0[A] -> Link [LNKC] -> GSI 5 (level, low) -> IRQ 5
    Bluetooth: Core ver 2.7
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Bluetooth: L2CAP ver 2.7
    Bluetooth: L2CAP socket layer initialized
    Bluetooth: RFCOMM ver 1.5
    Bluetooth: RFCOMM socket layer initialized
    Bluetooth: RFCOMM TTY layer initialized
    parport: PnPBIOS parport detected.
    parport0: PC-style at 0x378 (0x778), irq 7 [PCSPP,TRISTATE,EPP]
    lp0: using parport0 (interrupt-driven).
    lp0: console ready
    NET: Registered protocol family 10
    Disabled Privacy Extensions on device c03e6820(lo)
    IPv6 over IPv4 tunneling driver
    eth0: no IPv6 routers present


    tenho uma duvida tb , na hora q eu dei o resize na md0 , foi blz , porem na md1 nao foi de nenhum jeito!!
    sera pq as particoes eram LVM ??? como devo proceder qndo eh LVM???
    so para informacao , este teste eu fiz um RAID 1 em apenas 1 hd , ou seja , meramente teste .

  10. #10
    fabricio_
    Visitante

    Padrão Raid 1 sem formatar

    Depois de muita pesquisa , consegui utilizando o seguinte procedimento .
    Espero que ajude alguem , abracos .
    http://alioth.debian.org/projects/rootraiddoc