Re: Building software RAID mdmad adding a second disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Quoting israel.garcia@xxxxxxxxxxxx:

> Thanks Alexandar for your soon answer, BUT, is there another easier way
> to do this?

No, not really.  As far as I know, there isn't any GUI interface that  
will do the steps behind the scenes.  Anyhow, it isn't that complicated.

One thing I forgot to mention is to use fdisk to tag partitions as  
"Linux raid autodetect" (fd) when you are done.

The most troublesome part is to find out how much you need to shrink  
file systems before building mirrors.  According to md man page, md  
superblock (or metadata) is 4KB long and its start position is 64KB  
aligned.  That means you will loose between 64 and 128KB of partition  
space when building mirrors.

The simple way is to just assume worst case and shrink your file  
systems to be 128KB smaller than partition size.  Assuming example  
below (partition size 265041KB), you would shrink it to 265041 - 128 =  
264913KB.  Something like "resize2fs -p /dev/sda1 264913K".  You can  
always use resize2fs second time after mirrors are created to get any  
possibly unused space at the end of metadevice (as if anybody will  
care about couple of KB, but if it makes you happy go for it).  Just  
invoke resizefs like before, but this time do not specify size  
("resize2fs -p /dev/sda1").

Or if you are really into it, you can calculate exactly by how much  
you need to shrink file system.

[root@wis165 ~]# fdisk /dev/sda
Command (m for help): p

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          33      265041   83  Linux

So the sda1 is 265041KB in size.  This gives 265041 / 64 = 4141.265625  
64KB blocks.  Round it *down* to 4141.  Never round up.  You need to  
substract 1 for MD superblock, which gives 4140 usable 64KB blocks, so  
in this case file system needs to be resized to 4140 * 64 = 264960KB  
(in this case the file system will be shrinked by 81KB).  So you would  
simply do "resize2fs -p /dev/sda1 264960K".

Hmmm...  Maybe I should publish a new HOWTO ;-)

-- 
See Ya' later, alligator!
http://www.8-P.ca/


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux