LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-24-2009, 10:57 PM   #1
garydale
Member
 
Registered: Feb 2007
Posts: 142

Rep: Reputation: 23
how to resize software RAID partitions?


Googling tells you how to resize RAID partitions but not how to resize the underlying disk partitions. In my particular case, I initially sized a RAID array way too large - and when I added another disk to the array, I decided I was wasting too much space.

I shrunk the file system, then "grew" the array (/dev/md2) to the smaller size, and resized the file system again to fit. However the actual disk partitions (/dev/sda2, /dev/sdb2, etc.) are still the original size - they are just mostly unused space.

As I understand it, the superblocks are at the end of the partition. I believe this means the end of space used by the array on each device, so that the superblock moved to a lower block number when I shrunk the array. However it also means that I need to get the new physical partition size correct to avoid clobbering the superblock.

Is there an easy way to get any partition editor to shrink the physical partitions to the new array size?

If not, is the superblock included in the space allocated to the array so that the next partition can start in the very next block, or is it added after the array so I'd need to allow some space for it?

Thanks for any help you can offer!
 
Old 08-25-2009, 06:54 AM   #2
watcher69b
Member
 
Registered: Nov 2007
Location: /home/watcher69b
Distribution: RH, Fedora & CentOS
Posts: 552

Rep: Reputation: 41
try to install gparted. I believe you will be able to re-size the software RAID with out loosing any of the data.
 
Old 08-25-2009, 10:22 AM   #3
garydale
Member
 
Registered: Feb 2007
Posts: 142

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by watcher69b View Post
try to install gparted. I believe you will be able to re-size the software RAID with out loosing any of the data.
Yes, but the question is regarding what size to use. Gparted works with the physical partitions (/dev/sda2, etc.) not with the the RAID devices (/dev/md2) so I need to calculate the new size for the physical partitions. This means knowing what mdadm --grow did.

Since resize2fs probably doesn't know it's working on a software RAID array, I suspect the superblock is beyond the end of the /dev/md2 partition, so I would need to allow for it in resizing the physical partitions.
 
Old 08-25-2009, 02:34 PM   #4
garydale
Member
 
Registered: Feb 2007
Posts: 142

Original Poster
Rep: Reputation: 23
Done

I went ahead and resized the physical partitions. I couldn't get the size exactly right (at least non of the sizes I tried allowed mdadm to recognize the superblock), so I had to spend some time adding each drive back into the array and re-synching. Fortunately the new size was only 12G, so that went quickly.

I had to do this from a live disk in order to be able to keep the hard drives out of use during the operation. Otherwise it would take a reboot to get the new partition table to be used. Instead I was able to stop all the arrays using the disks, modify a partition table, resynch and move onto the next drive.
 
  


Reply



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
LXer: How To Resize RAID Partitions (Shrink & Grow) (Software RAID) LXer Syndicated Linux News 1 05-01-2009 12:02 PM
LXer: How To Resize LVM Software RAID1 Partitions (Shrink & Grow) LXer Syndicated Linux News 0 01-09-2009 02:11 PM
Resize RAID Partitions gsoft Linux - General 2 09-11-2008 04:23 AM
Recover software raid partitions knoppix d_t_baker Linux - Hardware 1 07-09-2005 07:19 AM
Create software RAID partitions first, then create filesystem partitions on top of th stefanlasiewski Linux - Software 1 04-28-2004 04:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09: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
Open Source Consulting | Domain Registration