LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 03-21-2012, 04:48 AM   #1
LBM
Member
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian
Posts: 114

Rep: Reputation: 1
mdadm: unable to resize volume


I have added a 4th disk to my RAID5 array in mdadm, and everything seems be OK after the resync. But I am unable to resize the volume.

The array is /dev/md0, and /dev/md0p1 is a partition thereof, and I think, this is what's causing the problems for me.

Trying to resize /dev/md0, unable to.
Code:
 resize2fs /dev/md0
resize2fs 1.41.12 (17-May-2010)
resize2fs: Bad magic number in super-block while trying to open /dev/md0
Couldn't find valid filesystem superblock.
Then I tried /dev/md0p1
Code:
resize2fs /dev/md0p1 
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 244192511 blocks long.  Nothing to do!
cfdisk /dev/md0 gives me this, so the free space is available on md0!
(It says it is ext3 but it is ext4 though).

Code:
cfdisk /dev/md0
                                       Disk Drive: /dev/md0
                                 Size: 1500320366592 bytes, 1500.3 GB
                        Heads: 2   Sectors per Track: 4   Cylinders: 366289152

     Name           Flags          Part Type    FS Type               [Label]            Size (MB)
 -----------------------------------------------------------------------------------------------------
     md0p1                          Primary     Linux ext3                              1000212.53
                                    Pri/Log     Free Space                               500107.84
If I do a mount, and do an info,it says ext4.?
Code:
/dev/md0p1    ext4    917G  839G   33G  97% /mnt/RAID5array
Any ideas? As said earlier, I think that the partition /dev/md0p1 of /dev/md0 is what is causing the problems.
The disk have been added to /dev/md0 and grown to /dev/md0.
 
Old 03-21-2012, 05:10 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,121

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by LBM View Post
As said earlier, I think that the partition /dev/md0p1 of /dev/md0 is what is causing the problems.
Certainly.
The (ext4) filesystem exists in a partition, not a device. So you need to (in order):
- resize the array
- resize the partition
- resize the filesystem.
 
Old 03-21-2012, 05:30 AM   #3
LBM
Member
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian
Posts: 114

Original Poster
Rep: Reputation: 1
I have already resized the array, I believe.

Code:
mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Sun Aug 14 14:54:46 2011
     Raid Level : raid5
     Array Size : 1465156608 (1397.28 GiB 1500.32 GB)
  Used Dev Size : 488385536 (465.76 GiB 500.11 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Wed Mar 21 11:11:36 2012
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 512K

           Name : thor:0  (local to host thor)
           UUID : 55facb29:039610c7:e38deaf1:b3fe71c2
         Events : 4024

    Number   Major   Minor   RaidDevice State
       0       8        0        0      active sync   /dev/sda
       1       8       16        1      active sync   /dev/sdb
       3       8       32        2      active sync   /dev/sdc
       4       8       48        3      active sync   /dev/sdd
But how do I resize the partition? I asume I have to resize /dev/md0p1, or should I use /dev/md0 ? Can parted handle mdadm arrays?

Code:
parted /dev/md0
GNU Parted 2.3
Using /dev/md0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Linux Software RAID Array (md)
Disk /dev/md0: 1500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      2048B  1000GB  1000GB  primary  ext4
Code:
 parted /dev/md0p1 
GNU Parted 2.3
Using /dev/md0p1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Unknown (unknown)
Disk /dev/md0p1: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  1000GB  1000GB  ext4
--edit--
I can create a new partition of /dev/md0 which is then named /dev/md0p2. So apperently something is working.

Last edited by LBM; 03-21-2012 at 06:04 AM.
 
Old 03-21-2012, 06:50 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,121

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by LBM View Post
But how do I resize the partition? I asume I have to resize /dev/md0p1, or should I use /dev/md0 ? Can parted handle mdadm arrays?
Yep (/dev/md0p1) - as you said, you've already done the array.
As for parted, I can't see why not - check the doco.
 
Old 03-21-2012, 08:02 AM   #5
LBM
Member
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian
Posts: 114

Original Poster
Rep: Reputation: 1
The question is now, how I can move the free diskspace from /dev/md0 to /dev/md0p1, without deleting data, so I can resize.
 
Old 03-21-2012, 10:56 AM   #6
LBM
Member
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian
Posts: 114

Original Poster
Rep: Reputation: 1
Solved it by deleting /dev/md0p1, and recreating it using the full size.
Next I ran resize2fs /dev/md0p1

No data was lost using this procedure!!!
 
Old 03-21-2012, 12:29 PM   #7
ba.page
Member
 
Registered: Feb 2012
Location: Canada
Distribution: Scientific,Debian
Posts: 35

Rep: Reputation: 7
wow! gutsy move! I'm glad it paid off for you.

due to the counter-intuitiveness of crossing fingers and deleting your array, I would suggest that if you're ever in this situation again, put LVM on top of your md array, and you'll have more control (and feedback) when resizing devices, partitions and filesystems.
 
Old 03-21-2012, 05:56 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,121

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Note that that was the partition that was deleted/reallocated.
It's what has to be done. The trick is to make sure the replacement starts (exactly) at the same sector.

There is software that hides the gory detail, but that is what happens "under the covers".
Ever heard of backups ?. Yes, even with RAID.
 
Old 03-25-2012, 04:56 AM   #9
LBM
Member
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian
Posts: 114

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
Note that that was the partition that was deleted/reallocated.
It's what has to be done. The trick is to make sure the replacement starts (exactly) at the same sector.

There is software that hides the gory detail, but that is what happens "under the covers".
Ever heard of backups ?. Yes, even with RAID.
Of course, I have heard of backups, and I do backups on daily basis, and yes I know that RAID is not any form of backup.
Unfortunately it is hard to backup 1+ TB of data, if you have nowhere to store it.
 
  


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
Resize the Logical volume navin.altair Linux - Hardware 2 02-16-2012 09:32 PM
resize LVM volume harshaabba Linux - Server 2 10-13-2010 02:23 PM
Raid1 MDADM, root volume weirdness SanRamonCA Linux - Server 17 07-25-2010 07:57 AM
unable to load MDADM module BUT mdadm works?!?!?! alirezan1 Linux - Software 2 09-08-2008 07:58 PM
Fedora LVM volume group & Physical Volume resize problem gabeyg Fedora 1 05-14-2008 11:26 AM

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

All times are GMT -5. The time now is 09:34 AM.

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