Setting Up Network RAID1 With DRBD on Ubuntu 11

12
04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 _ HowtoForge - Linux Howtos and Tutorials 1/12 www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10 Options For This Howto FUee SXppoUW Paid SXppoUW Navigation [+] E[pand [] CollapVe HoZWoV LinX[ AndUoid CenWOS Debian FedoUa KeUnel MandUiYa PCLinX[OS SXSE UbXnWX Web SeUYeU Apache CheUokee LighWWpd ngin[ BackXp ConWUol PanelV ISPConfig DNS BIND M\DNS PoZeUDNS djbdnV DeVkWop Email AnWi Spam/ViUXV PoVWfi[ FTP HighAYailabiliW\ Search Ads b\ Google UbXnWX UbXnWX認ᐖ BX\ UbXnWX CD CF 19 UbXnWX Register Login Contribute Subscribe RSS NeZs FAQForge ISPConfig Subscribe Contribute Forums HoZtos

Transcript of Setting Up Network RAID1 With DRBD on Ubuntu 11

Page 1: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

1/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

        

    

    

    

    

Options For ThisHowtoFree SupportPaid Support

Navigation[+] Expand [­] Collapse

HowtosLinuxAndroidCentOSDebianFedoraKernelMandrivaPCLinuxOSSuSEUbuntu

Web ServerApacheCherokeeLighttpdnginx

BackupControl PanelsISPConfig

DNSBINDMyDNSPowerDNSdjbdns

DesktopEmailAnti­

Spam/VirusPostfix

FTPHigh­Availability

Search

Ads by Google   Ubuntu   Ubuntu認證   Buy Ubuntu CD  CF 19 Ubuntu

Register Login Contribute Subscribe RSS

NewsFAQForgeISPConfigSubscribeContributeForumsHowtos

             

Page 2: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

2/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

    

    

    

    

    

High­AvailabilityMonitoringMySQLProgrammingC/C++PHP

SambaSecurityAnti­

Spam/VirusStorageVirtualizationKVMOpenVZVMwareVirtualBoxXen

OtherFreeBSDCommercial

Mini­HowtosForumsContributeSubscriptionLoginSite Map/RSS Feeds

User loginUsername:

Password:

Remember Me?

Log in

Create a new accountRequest new password

Facebook

Page 3: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

3/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

Find us onFacebook

HowtoForge

2,469 people like

LikeFacebook social plugin

Who's onlineThere are currently 12users and 3731 guestsonline.

HowtoForgeForumsNeed to use theSMTP from my homePC

how to access my1st site

Problem updatingfrom 3.0.3.3 to3.0.4

Problem with theimplementation oftHttpdCGI

Problems withemails server(postfix, courier,...

How to BenchmarkCPU

[3.0.4 update]Reseller Website ­text inserted

Error updatingfrom 3.0.3.2 to3.0.4

Perfect serverdebian squeezeipsconfig 3.04 ...

Page 4: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

4/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

ipsconfig 3.04 ...

sharing a folder

NewsIndie game donation drive!

Open64 Compiler TuningOn AMD Bulldozer FX­8150

Ubuntu: PowerConsumption, KVM,Mozilla, Etc

How to Color Code YourTerminal in Gnome Shell3.x

How To Let YourWallpapers Rotate WithWebilder (Linux Mint 11)

SystemRescueCd 2.4.0Has Linux Kernel 3.1.0

In Conversation: JimZemlin of the LinuxFoundation

Writing manual pages onLinux

Indicator Applet Ported ToGNOME 3, Can Already BeUsed In Ubuntu 11.10Classic Session

Canonical Will DevelopUnity for Phones

more

Recent commentsRe: reg. Step­10 rpm Buildtarget folder14 hours 38 min ago

Pleasantly Suprised14 hours 40 min ago

Issues with WIndows XP?15 hours 1 min ago

alternatives16 hours 25 min ago

Re: Winetricks often

Page 5: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

5/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

Re: Winetricks oftenneeded19 hours 8 min ago

Re: Not necessary to buildGlusterFS from source1 day 36 min ago

EXT4 with DRBD?!1 day 14 hours ago

Database server1 day 20 hours ago

Re: If you have CentOS 5.42 days 1 hour ago

.xml file is not beingcreated2 days 1 hour ago

NewsletterSubscribe toHowtoForgeNewsletterand stay informed aboutour latest HOWTOs andprojects.

enter email address

Submit

(To unsubscribe fromour newsletter, visit thislink.)

English | Deutsch | Site Map/RSS Feeds | Advertise

You are here: Home » Howtos » Linux » Ubuntu » Setting Up Network RAID1 With DRBD On Ubuntu 11.10

Setting Up Network RAID1 With DRBD On Ubuntu 11.10

Want to support HowtoForge? Become a subscriber!

Submitted by falko (Contact Author) (Forums) on Sun, 2011-10-30 20:34. :: Ubuntu | High-Availability | Storage

Page 6: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

6/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

6 27

Submitted by falko (Contact Author) (Forums) on Sun, 2011-10-30 20:34. :: Ubuntu | High-Availability | Storage

Setting Up Network RAID1 With DRBD On Ubuntu 11.10

Version 1.0 Author: Falko Timme <ft [at] falkotimme [dot] com>

Follow me on TwitterLast edited 10/28/2011

This tutorial shows how to set up network RAID1 with the help of DRBD on two Ubuntu 11.10 systems. DRBD stands forDistributed Replicated Block Device and allows you to mirror block devices over a network. This is useful for high-availability setups(like a HA NFS server) because if one node fails, all data is still available from the other node.

I do not issue any guarantee that this will work for you!

1 Preliminary NoteI will use two servers here (both running Ubuntu 11.10):

server1.example.com (IP address 192.168.0.100)

server2.example.com (IP address: 192.168.0.101)

Both nodes have an unpartitioned second drive (/dev/sdb) with identical size (30GB in this example) that I want to mirror over the network (network RAID1) with the help of DRBD.

It is important that both nodes can resolve each other, either through DNS or through /etc/hosts. If you did not create DNS records for server1.example.com and

server2.example.com, you can modify /etc/hosts on both nodes as follows:

server1/server2:

vi /etc/hosts

18 SendLike

Page 7: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

7/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

127.0.0.1       localhost.localdomain   localhost192.168.0.100   server1.example.com     server1192.168.0.101   server2.example.com     server2

# The following lines are desirable for IPv6 capable hosts::1     ip6­localhost ip6­loopbackfe00::0 ip6­localnetff00::0 ip6­mcastprefixff02::1 ip6­allnodesff02::2 ip6­allrouters

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su

2 Synchronize Timeserver1/server2:

It is very important that both nodes have the same time. Therefore we install the ntp packages:

apt­get install ntp ntpdate

3 Partition /dev/sdb

Page 8: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

8/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

3 Partition /dev/sdbserver1/server2:

Right now, our partitioning looks as follows:

fdisk ­l

root@server1:~# fdisk ­l

Disk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000712c1

   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048      499711      248832   83  Linux/dev/sda2          501758    62912511    31205377    5  Extended/dev/sda5          501760    62912511    31205376   8e  Linux LVM

Disk /dev/sdb: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/mapper/server1­root: 31.4 GB, 31415336960 bytes255 heads, 63 sectors/track, 3819 cylinders, total 61358080 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

Disk /dev/mapper/server1­root doesn't contain a valid partition table

Disk /dev/mapper/server1­swap_1: 536 MB, 536870912 bytes255 heads, 63 sectors/track, 65 cylinders, total 1048576 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Page 9: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

9/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

Disk identifier: 0x00000000

Disk /dev/mapper/server1­swap_1 doesn't contain a valid partition tableroot@server1:~#

As you see, /dev/sdb is not partitioned. We change that now and create one big partition on it, /dev/sdb1:

fdisk /dev/sdb

root@server1:~# fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0xf7ab5969.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): <-- n

Command action   e   extended   p   primary partition (1­4)<-- p

Partition number (1­4, default 1): <-- 1

First sector (2048­62914559, default 2048): <-- ENTER

Using default value 2048Last sector, +sectors or +size{K,M,G} (2048­62914559, default 62914559): <-- ENTER

Using default value 62914559

Command (m for help): <-- t

Selected partition 1Hex code (type L to list codes): <-- 83

Command (m for help): <-- w

The partition table has been altered!

Calling ioctl() to re­read partition table.Syncing disks.root@server1:~#

Now run

fdisk ­l

again, and you should find /dev/sdb1 in the output:

Page 10: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

10/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

again, and you should find /dev/sdb1 in the output:

root@server1:~# fdisk ­l

Disk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000712c1

   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048      499711      248832   83  Linux/dev/sda2          501758    62912511    31205377    5  Extended/dev/sda5          501760    62912511    31205376   8e  Linux LVM

Disk /dev/sdb: 32.2 GB, 32212254720 bytes64 heads, 51 sectors/track, 19275 cylinders, total 62914560 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0xf7ab5969

   Device Boot      Start         End      Blocks   Id  System/dev/sdb1            2048    62914559    31456256   83  Linux

Disk /dev/mapper/server1­root: 31.4 GB, 31415336960 bytes255 heads, 63 sectors/track, 3819 cylinders, total 61358080 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

Disk /dev/mapper/server1­root doesn't contain a valid partition table

Disk /dev/mapper/server1­swap_1: 536 MB, 536870912 bytes255 heads, 63 sectors/track, 65 cylinders, total 1048576 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

Disk /dev/mapper/server1­swap_1 doesn't contain a valid partition tableroot@server1:~#

Page 11: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

11/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

nextSetting Up Network RAID1 With DRBD On Ubuntu 11.10 - Page 2

� 27

Setting Up Network RAID1 With DRBD On Ubuntu 11.10 - Page 2

Copyright © 2011 Falko TimmeAll Rights Reserved.

add comment | view as pdf | print: this | all page(s)

Please do not use the comment function to ask for help! If you need help, please use our forum.Comments will be published after administrator approval.

Howtos | Mini-Howtos | Forums | News | Search | Contribute | SubscriptionSite Map/RSS Feeds | Advertise | Contact | Disclaimer | Imprint

Copyright © 2011 HowtoForge - Linux Howtos and TutorialsAll Rights Reserved.

18 SendLike

Page 12: Setting Up Network RAID1 With DRBD on Ubuntu 11

04/11/11 Setting Up Network RAID1 With DRBD On Ubuntu 11.10 | HowtoForge - Linux Howtos and Tutorials

12/12www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10