I'm currently trying to simulate the environment via XEN. I have installed two debian systems with such FS layout:
cltest1:/etc# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda2 6.0G 417M 5.2G 8% / tmpfs 257M 0 257M 0% /lib/init/rw udev 10M 16K 10M 1% /dev tmpfs 257M 4.0K 257M 1% /dev/shm
Host cltest2 is identical.
Here's my drbd.conf
global { minor-count 1; } resource mysql { protocol C; syncer { rate 10M; # 10 Megabytes } on cltest1 { device /dev/drbd0; disk /dev/xvda2; address 192.168.1.186:7789; meta-disk internal; } on cltest2 { device /dev/drbd0; disk /dev/xvda2; address 192.168.1.187:7789; meta-disk internal; } }
I have not created filesystem on drbd0
Starting DRBD via init.d script errors out with:
Starting DRBD resources: [ d(mysql) /dev/drbd0: Failure: (114) Lower device is already claimed. This usually means it is mounted. [mysql] cmd /sbin/drbdsetup /dev/drbd0 disk /dev/xvda2 /dev/xvda2 internal --set-defaults --create-device failed - continuing!
Running: drbdadm create-md mysql gives:
cltest1:/etc# drbdadm create-md mysql md_offset 6442446848 al_offset 6442414080 bm_offset 6442217472 Found ext3 filesystem which uses 6291456 kB current configuration leaves usable 6291228 kB Device size would be truncated, which would corrupt data and result in 'access beyond end of device' errors. You need to either * use external meta data (recommended) * shrink that filesystem first * zero out the device (destroy the filesystem) Operation refused. Command 'drbdmeta /dev/drbd0 v08 /dev/xvda2 internal create-md' terminated with exit code 40 drbdadm aborting
As I understand, all of my problems are because I don't have unallocated disk space on xvda2.
What are my options besides shrinking FS and connecting a separate physical disk? Can't the meta-data be stored on a file in the local filesystem?
drbd can sometimes pickup 'existing' filesystems even without one being on the sytem. You could of
dd if=/dev/zero of=/dev/xvda2
(and control-C after a few secs) and it will clear the partition that could of held a filesystem before.You are not suppose to mount the disk with any filesystem format; In Ubuntu, using gparted I specified the /dev/xvda2 to "Cleared" partition. and running the same command removes the above error.
1) Take note of womble's comment
2) Options for DRBD Metadata (All must be block devices AFAIK)
A) Internal - good for a device that has never been used (not your situation)
B) "External" - A seperate partition / drive, this could also be a Ramdisk but your metadata will disappear between power cycles
So You Can
A) Rebuild the system with different partitions and use drbd from the start on the data partitions
B) Use a Ramdisk that disappears between reboot
C) Add a drive(USB, eSATA, internal, etc) for metatdata.
Good Luck - DRBD is a good thing.
I dont' grab what you are trying to do. cltest1 and cltest2 will never run concurrent?
Why do you want to mirror the root-filesystems between those two systems?
Do you run cltest1 and cltest2 on the same hardware?
For the drbd-meta-device: put it on it's own LV. On that LV use indexing. e.g.
meta-disk /dev/VG/drbd_meta [1]; The next drbd can use index 2 on the same LV. That way you could use an LV with 1 GB for many DRBD-devices.