DRBD at CloudServers Without the Loop Device - Operation FAILED
DRBD at CloudServers
This is a short guide on getting DRBD working @ Rackspace CloudServers Please note I will be resizing the root partition on the cloud server, this is not for the squeemish!
I highly recomend you only attempt this on new builds or throw away virtual machines, this only works for ext3 filesystems I have not tested nor do I know the implications of trying this on ext4!
rescue mode
In this first step we need to place the cloudserver in Rescue mode, so.
- log into your rackspacecloud portal.
- Hosting
- Cloud Servers
- Click server
- Click Rescue
Read the prompt:
1 2 3 4 5 |
|
Note: In rescue mode /dev/xvda becomes /dev/sda
You can shose at this point to connect via SSH or via the Web Console, I will be opting for SSH.
Note: the host key is generated at startup, your ssh client will alert about a miss matching host key if you have allready connected to this host before. Or as a one off:
1
|
|
Do not use this reguarly, unless you enjoy the prospect of being an easy m.i.t.m target.
Now we need to record some information, however the text above is missleading /dev/sda does not exist as a device, this has been confirmed by Rackspace as information from the previous infrastructure (Slicehost I’d assume), the actual device is: /dev/xvdb (1 Data, 2 Swap) (And with any luck they will correct this soon within the system)
Now we need to do some information collecting so for now just mount /dev/xvdb1 onto /media:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
Note: You could in get all this information before dropping into rescue mode if you really wanted to.
Preparation
First a fsck we want it to report a clean FS without attempting any changes so we run this with the -n option, go grab a coffee this will take a while:
1 2 3 4 5 |
|
Great we have a clean FS (note it will rpoert erros if the fs is still mounted!) we need to remove the journal, which essentially will turn a ext3 FS into ext2:
1 2 |
|
Force a filesystem check with e2fsck -f:
1 2 3 4 5 6 7 |
|
Now we can resize the filesystem from the recon above we know that we are presentl using 2.1GB / 75GB so in this case I will “shave” 20GB off the top to become the DRBD volume
1 2 3 |
|
Now we need to delete and recreate our partitions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
Wait how did I get 59136000K for the last cylinder? well we take 14080000 from resize2fs multiply by 4 and again by 1.05, why?
- 4K blocksize
- 1.05 gives us a 5% saftey buffer
- final figure 59136000K
- the option a is used to set the bootable flag back onto parition 1
Now we check the filesystem
1 2 3 4 5 6 7 8 9 10 |
|
Awww crap … right lets find out where that superblock is we run mke2fs with the -n flag this is a dry run, it will not write filesystem changes::
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Ok NONE of these superblock worked for me … BLAM trashed VM, see why I suggested a throw away!
I am frankly stumped on this one … I’ve posted it anyway as some of the information may be useful.
Sources
- https://rackerhacker.com/2011/02/13/dual-primary-drbd-with-ocfs2/
- https://www.howtoforge.com/linux_resizing_ext3_partitions i
- https://www.cyberciti.biz/faq/recover-bad-superblock-from-corrupted-partition/