Difference between revisions of "Fs-drbd"
From Bashlinux
(talk) |
|||
Line 3: | Line 3: | ||
== How to setup DRBD with separated resource and meta-disk == |
== How to setup DRBD with separated resource and meta-disk == |
||
− | + | '''On both servers''' |
|
− | + | # Create 2 separate partitions on each server, one for meta and one for data. Some meta-disk size approximations: |
|
||'''Block device size'''||'''DRBD meta data'''|| |
||'''Block device size'''||'''DRBD meta data'''|| |
||
|| 1 GB || 2 MB || |
|| 1 GB || 2 MB || |
||
Line 66: | Line 66: | ||
− | + | '''On primary server''' |
|
+ | |||
When finish the previous setup on both servers |
When finish the previous setup on both servers |
||
# Tell DRBD which one is the primary |
# Tell DRBD which one is the primary |
Revision as of 16:51, 3 November 2012
DRBD
How to setup DRBD with separated resource and meta-disk
On both servers
- Create 2 separate partitions on each server, one for meta and one for data. Some meta-disk size approximations:
||Block device size||DRBD meta data|| || 1 GB || 2 MB || || 100 GB || 4+1 MB || || 500 GB || 16+2 MB || || 1 TB || 32+2 MB || || 2 TB || 64+1 MB || || 4 TB || 128 MB ||
- If the meta-disk and resource partition are listed on fstab, then remove them from there
- Install drbd
# apt-get -y install drbd8-utils
- Edit `drbd.conf` to something similar to:
global { usage-count no; } common { syncer { rate 100M; } } resource srv { protocol C; startup { wfc-timeout 15; degr-wfc-timeout 60; } net { cram-hmac-alg sha1; shared-secret "B1ng0!"; } on SERVER-01p { device /dev/drbd0; disk /dev/md4; address IP_SERVER-01p:7788; meta-disk /dev/md3[0]; } on SERVER-01s { device /dev/drbd0; disk /dev/md4; address IP_SERVER-01s:7788; meta-disk /dev/md3[0]; } }
- Create resource and meta-disk
# drbdadm create-md srv
- Start DRBD
# service drbd start
On primary server
When finish the previous setup on both servers
- Tell DRBD which one is the primary
# drbdadm -- --overwrite-data-of-peer primary all
This going to take a long, depending of the size of the drive. The sync can be watched at `/proc/drbd` file.
- When drbd sync is done, then, create the filesystem on drbd device
# mkfs.ext4 /dev/drbd0
- Finally, mount drbd device on the primary server
# mount /dev/drbd0 /srv