LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-29-2013, 11:25 PM   #1
jollypirate
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
Unhappy RAID1, mdadm, and slightly mismatched PV sizes (Ubuntu)


I'm a newbie to the world of setting up software RAID with mdadm and am confused about why one of my PVs is ending up smaller than I expect it to.

Trying to follow this very clear FAQ http://www.howtoforge.com/how-to-set...n-ubuntu-10.04 to set up RAID1 on my box.

My system setup is:
  • Ubuntu
  • 2x 2TB drives
  • Default Ubuntu partitions on drive 1 (/dev/sda), empty drive 2 (/dev/sdb)

All is well until I use mdadm to create the two RAID volumes md0 and md1 and then do a pvcreate on md1.

Quote:
captain@risa:~$ sudo mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
captain@risa:~$ sudo mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb5
mdadm: /dev/sdb5 appears to contain an ext2fs file system
size=976510976K mtime=Wed Dec 31 19:00:00 1969
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
captain@risa:~$ sudo cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md1 : active raid1 sdb5[1]
976379712 blocks super 1.2 [2/1] [_U]

md0 : active raid1 sdb1[1]
248640 blocks super 1.2 [2/1] [_U]

unused devices: <none>
captain@risa:~$ sudo lvdisplay
--- Logical volume ---
LV Name /dev/risa/root
VG Name risa
LV UUID pk44SY-IPxT-226g-aBK8-lnc3-k5YE-KIhyvj
LV Write Access read/write
LV Status available
# open 1
LV Size 923.33 GiB
Current LE 236373
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0

--- Logical volume ---
LV Name /dev/risa/swap_1
VG Name risa
LV UUID TnG5BB-LRuM-N8sx-BTvZ-q38E-IupP-lHevaD
LV Write Access read/write
LV Status available
# open 2
LV Size 7.89 GiB
Current LE 2021
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1

captain@risa:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name risa
PV Size 931.27 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238405
Free PE 11
Allocated PE 238394
PV UUID OFPdJC-0p17-Rkeh-H1mZ-3FeL-mdKZ-vAkw5o

captain@risa:~$ sudo pvcreate /dev/md1
Physical volume "/dev/md1" successfully created
captain@risa:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name risa
PV Size 931.27 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238405
Free PE 11
Allocated PE 238394
PV UUID OFPdJC-0p17-Rkeh-H1mZ-3FeL-mdKZ-vAkw5o

"/dev/md1" is a new physical volume of "931.15 GiB"
--- NEW Physical volume ---
PV Name /dev/md1
VG Name
PV Size 931.15 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Q73v6U-pYT4-GfLJ-ua9L-Kaw0-lDGZ-VgkIXQ
You can see the PV size for /dev/md1 is *ever so slightly* smaller than the existing PV for /dev/sda5, which makes an attempted "pvmove -i 2 /dev/sda5 /dev/md1" very unhappy. If I do a straight pvcreate on /dev/sdb5 the resulting PV is the same size as /dev/sda5 (931.27 GiB, instead of 931.15).

So, er, into which arcane vortex is that tiny bit of extra space going? Is it as simple as that metadata the mdadm is complaining about during the RAID volume creation?

More importantly, is my best option to boot up from live media and shrink the filesystem and volume for /dev/sda5, or is there a less painful way to get my RAID working?
 
Old 01-30-2013, 04:39 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,813

Rep: Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749Reputation: 749
Yes. Creating a RAID needs some overhead on disk in which to store metadata. Don't create a RAID without on-disk metadata unless you like taking notes and reassembling it by hand. Also make sure grub is installed in both mirrors holding /boot so either can boot after a disk failure.

I don't think I would try to do pvmove on my live system even if I did have enough space, so you're more intrepid than me.
Your idea of booting from live media sounds practical (assuming you have good backups).
You could do file-by-file copy using rsync. That would be a lot slower than block copy, tho.

Personally I've just reloaded the system rather than attempt to convert a non-RAID system to mirrored. Please post back and let us know how it worked out.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mdadm raid1 both bootable chiendarret Linux - Server 1 03-09-2009 07:53 AM
Migrate to a raid1 with mdadm Ossar Linux - Software 2 08-19-2008 11:55 AM
Software RAID1 with mdadm bujecas Debian 0 10-26-2006 09:56 AM
sw RAID - mdadm - Almost Done! - HD sizes differ slightly Supafast Linux - General 1 07-27-2005 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration