sobota, 27 października 2007

How to create partitions based on RAID

Nowadays, when I create new server class machine it has allways kind of mirroring. There are sometimes questions how to properly create RAID partitions, what is practice? Here is easy scheme:

We want install two disks 250GB both. They will be mirrored with RAID1. Additionally we want to have LVM on my main RAID partition.

Firstly we have to remember that /boot partition can't be located on LVM. Why? Bootloader can't use LVM. It has to start initrd and then it can start LVM partitions.

So, we create two partitions, same on each disk and bind then into two RAID1 partitions. First, small one, is for /boot while the second is for LVM. On LVM partition we can put partitions anyhow because there is possibility to change size of them in the future. It is not recommended to change size of /root partition (especially reduce) but it is not impossible. We have to remember about swap partition and that is all.

Here are outputs of few commands:

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]

md1 : active raid1 sdb2[1] sda2[0]
244091520 blocks [2/2] [UU]

unused devices:

# df -h
System plików rozm. użyte dost. %uż. zamont. na
/dev/mapper/wew-root 7,6G 2,5G 4,8G 35% /
/dev/md0 99M 16M 78M 17% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/mapper/wew-home 9,5G 154M 8,9G 2% /home
/dev/mapper/wew-var 19G 536M 18G 3% /var

# cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/wew-swap partition 2031608 0 -1

# lvdisplay
/dev/hdc: open failed: Brak medium
--- Logical volume ---
LV Name /dev/wew/root
VG Name wew
LV UUID MHnbOQ-cn2n-Vc0y-xPJA-naUS-KXx5-ZgJYMt
LV Write Access read/write
LV Status available
# open 1
LV Size 7,81 GB
Current LE 250
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/wew/home
VG Name wew
LV UUID gPZHmg-3R7e-Aveg-1fAv-olOV-Du15-zjIvfp
LV Write Access read/write
LV Status available
# open 1
LV Size 9,75 GB
Current LE 312
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

--- Logical volume ---
LV Name /dev/wew/var
VG Name wew
LV UUID HbT3ha-MiRz-y902-xkyb-3Ehj-n3zg-RHvAB6
LV Write Access read/write
LV Status available
# open 1
LV Size 19,53 GB
Current LE 625
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:2

--- Logical volume ---
LV Name /dev/wew/swap
VG Name wew
LV UUID 3cLfN5-GzEX-Wrjq-IHvc-Vzx3-lkfB-smhC4n
LV Write Access read/write
LV Status available
# open 1
LV Size 1,94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:3


As you can see I'm not using whole disk space. I don't know now what will be bigger in the future, /home or /var, but i'll be able to expand them freely.

Brak komentarzy: