Changes between Version 2 and Version 3 of TipAndDoc/HA/NFS


Ignore:
Timestamp:
Mar 24, 2011 6:46:31 PM (13 years ago)
Author:
mitty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TipAndDoc/HA/NFS

    v2 v3  
    1313 * Tested with VMware Workstation 7.1.3 
    1414 
    15  == DRBD on LVM with RAID1 == 
     15 * see [./log] for verbose log 
     16 
     17 = DRBD on LVM with RAID1 = 
    1618 * Primary 
    1719  * /dev/sd[bc]1 -> /dev/md0 (RAID1) 
     
    6769                              ----------------------- 
    6870}}} 
     71 
     72 == packages == 
     73 * sudo aptitude install -R mdadm 
     74  * -R が無いと postfix を同時インストールされる 
     75 * sudo aptitude install lvm2 
     76 * sudo aptitude install drbd8-utils -R 
     77  * -R が無いと build-essential 等を同時インストールされる 
     78 
     79 == setup block devices == 
     80 
     81 === fdisk === 
     82 * mitty@ubuntu-haa:~$ ls -l /dev/sd? 
     83{{{ 
     84brw-rw---- 1 root disk 8,  0 2011-03-24 17:20 /dev/sda 
     85brw-rw---- 1 root disk 8, 16 2011-03-24 17:20 /dev/sdb 
     86brw-rw---- 1 root disk 8, 32 2011-03-24 17:20 /dev/sdc 
     87}}} 
     88 
     89 * mitty@ubuntu-haa:~$ sudo fdisk -u /dev/sdb 
     90{{{ 
     91 
     92Command (m for help): n 
     93Command action 
     94   e   extended 
     95   p   primary partition (1-4) 
     96p 
     97Partition number (1-4): 1 
     98First sector (63-4194303, default 63): 
     99Using default value 63 
     100Last sector, +sectors or +size{K,M,G} (63-4194303, default 4194303): +2000M 
     101 
     102Command (m for help): t 
     103Selected partition 1 
     104Hex code (type L to list codes): fd 
     105Changed system type of partition 1 to fd (Linux raid autodetect) 
     106 
     107Command (m for help): p 
     108 
     109Disk /dev/sdb: 2147 MB, 2147483648 bytes 
     110255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors 
     111Units = sectors of 1 * 512 = 512 bytes 
     112Sector size (logical/physical): 512 bytes / 512 bytes 
     113I/O size (minimum/optimal): 512 bytes / 512 bytes 
     114Disk identifier: 0x7faa0456 
     115 
     116   Device Boot      Start         End      Blocks   Id  System 
     117/dev/sdb1              63     4096063     2048000+  fd  Linux raid autodetect 
     118Partition 1 does not end on cylinder boundary. 
     119 
     120Command (m for help): w 
     121The partition table has been altered! 
     122 
     123Calling ioctl() to re-read partition table. 
     124Syncing disks. 
     125}}} 
     126  * 同じ容量のHDDでも、メーカによって微妙にサイズが異なることがあるので、交換する際のことを考えるとディスク全体をパーティションに割り当てない方が良い 
     127 * mitty@ubuntu-haa:~$ sudo fdisk -u /dev/sdb 
     128{{{ 
     129Disk identifier: 0x509a8b0b 
     130 
     131   Device Boot      Start         End      Blocks   Id  System 
     132/dev/sdc1              63     4096063     2048000+  fd  Linux raid autodetect 
     133Partition 1 does not end on cylinder boundary. 
     134}}} 
     135 
     136 === mdadm === 
     137 * mitty@ubuntu-haa:~$ sudo mdadm --create /dev/md0 -l1 -n2 /dev/sd[bc]1 
     138{{{ 
     139mdadm: array /dev/md0 started. 
     140}}} 
     141 
     142 * mitty@ubuntu-haa:~$ cat /proc/mdstat 
     143{{{ 
     144Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
     145md0 : active raid1 sdc1[1] sdb1[0] 
     146      2047936 blocks [2/2] [UU] 
     147      [>....................]  resync =  0.2% (4160/2047936) finish=8.1min speed=4160K/sec 
     148 
     149unused devices: <none> 
     150}}} 
     151 
     152 * mitty@ubuntu-haa:~$ sudo mdadm -D /dev/md0 
     153  * see [./log#mdadm-Ddevmd0] 
     154 
     155 * mitty@ubuntu-haa:~$ sudo mdadm -Es 
     156{{{ 
     157ARRAY /dev/md0 level=raid1 num-devices=2 UUID=32578407:6f33f50b:893cf340:745f5dce 
     158}}} 
     159 * mitty@ubuntu-haa:~$ sudo sh -c "mdadm -Es >> /etc/mdadm/mdadm.conf" 
     160 
     161 * mitty@ubuntu-haa:~$ sudo dpkg-reconfigure mdadm 
     162{{{ 
     163  ┌──────────────────────────┤ Configuring mdadm ├─ 
     164 
     165(snip) 
     166}}} 
     167  * see [./log#dpkg-reconfiguremdadm] 
     168  * see also wiki:TipAndDoc/RAID#dpkg-reconfiguremdadm 
     169  * command result 
     170{{{ 
     171 * Stopping MD monitoring service mdadm --monitor                        [ OK ] 
     172Generating array device nodes... /var/lib/dpkg/info/mdadm.postinst: line 27: /dev/MAKEDEV: No such file or directory 
     173failed. 
     174 Removing any system startup links for /etc/init.d/mdadm-raid ... 
     175update-initramfs: Generating /boot/initrd.img-2.6.32-30-generic-pae 
     176update-rc.d: warning: mdadm start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (S) 
     177update-rc.d: warning: mdadm stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (0 6) 
     178 * Starting MD monitoring service mdadm --monitor                        [ OK ] 
     179}}}