LinuxQuestions.org
Help answer threads with 0 replies.
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 01-05-2014, 12:26 AM   #1
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Rep: Reputation: 17
[SOLVED] Error with trying to resize software raid device


Hello,

I have a failed raid array that is mismatched in size of the entire hard drives. The portions that are shared are, of course, the same. The smaller drive failed. Here is the working drive setup (a picture is worth 1000 words).

http://i1363.photobucket.com/albums/...ps0e669ba5.png

As you can see, I would like to grow sdb6 into the unallocated area.

This is my /proc/mdstat file

Code:
Personalities : [raid1] 
md0 : active raid1 sdb6[1]
      717040448 blocks super 1.2 [2/1] [_U]
      
unused devices: <none>
This is my fdisk -l
Code:
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00011318

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    41945087    20971520   83  Linux
/dev/sdb2        41945088  1953523711   955789312    5  Extended
/dev/sdb5        41947136    54530047     6291456   82  Linux swap / Solaris
/dev/sdb6       519178240  1953523711   717172736   fd  Linux raid autodetect

Disk /dev/md0: 734.2 GB, 734249418752 bytes
2 heads, 4 sectors/track, 179260112 cylinders, total 1434080896 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table
And this is the saved error from gparted when I try to resize that partition.

Code:
GParted 0.12.1 --enable-libparted-dmraid

Libparted 2.3
Move /dev/sdb6 to the left and grow it from 683.95 GiB to 905.50 GiB  00:00:00    ( ERROR )
         
calibrate /dev/sdb6  00:00:00    ( SUCCESS )
         
path: /dev/sdb6
start: 519,178,240
end: 1,953,523,711
size: 1,434,345,472 (683.95 GiB)
check file system on /dev/sdb6 for errors and (if possible) fix them  00:00:00    ( ERROR )
         
e2fsck -f -y -v /dev/sdb6
         
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
e2fsck: Group descriptors look bad... trying backup blocks...
e2fsck: Bad magic number in super-block while using the backup blockse2fsck: going back to original superblock

Linux_HomeR2: ********** WARNING: Filesystem still has errors **********

e2fsck 1.42.5 (29-Jul-2012)
e2fsck: A block group is missing an inode table while checking ext3 journal for Linux_HomeR2

========================================
Of note, I am following the directions from a website http://www.zedt.eu/tech/linux/resize...m-raid1-device.

I got an error at this step:

Code:
#> mdadm --fail /dev/md0 /dev/sdb6
mdadm: set device faulty failed for /dev/sdb6:  Device or resource busy
With the error that it couldn't faulty the drive as the device or resource was busy. However, the device wasn't in use at all, so I'm not sure why it was saying that.

I tried the resize after successfully doing:

Code:
mdadm -S /dev/md0
This is when I tried the resize using gparted with the above error.

Any help is appreciated.

Last edited by narnie; 01-11-2014 at 09:45 PM.
 
Old 01-05-2014, 05:13 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,064

Rep: Reputation: Disabled
There are a few things about your setup that doesn't make sense. First, there's the description of /dev/sdb6:
Quote:
Originally Posted by narnie View Post
Here is the working drive setup (a picture is worth 1000 words).

http://i1363.photobucket.com/albums/...ps0e669ba5.png
According to the picture, there's an ext3 file system on /dev/sdb6. There shouldn't be.

Either /dev/sdb6 is a component in a software RAID, in which case it contains an md volume, or it's a formatted partition containing a file system, which means it can't be part of a RAID array.

The partition table type (which is nothing more than a label) says "RAID", and /proc/mdstat confirms that the partition is indeed a RAID component. In other words, GParted is confused about the contents of this partition, which is bad news.
Quote:
Originally Posted by narnie View Post
As you can see, I would like to grow sdb6 into the unallocated area.
Since the free space appears before the partition, the entire partition will have to be moved then expanded.
Quote:
Originally Posted by narnie View Post
This is my /proc/mdstat file

Code:
Personalities : [raid1] 
md0 : active raid1 sdb6[1]
      717040448 blocks super 1.2 [2/1] [_U]
      
unused devices: <none>
Metadata version 1.2 means the RAID metadata is at the beginning of the partition. Do not under any circumstances attempt to fsck the partition directly, as it will at best accomplish nothing, and could potentially destroy the entire RAID by altering the metadata.

The RAID is "active", which means you must stop it before you can move the partition. I assume the output above was the contents of /proc/mdstat before you ran mdadm -S /dev/md0?
Quote:
Originally Posted by narnie View Post
And this is the saved error from gparted when I try to resize that partition.

Code:
GParted 0.12.1 --enable-libparted-dmraid

Libparted 2.3
Move /dev/sdb6 to the left and grow it from 683.95 GiB to 905.50 GiB  00:00:00    ( ERROR )
The operation should work, but if the RAID is active, any attempt to manipulate the partition could have disastrous consequences.
Quote:
Originally Posted by narnie View Post
Code:
calibrate /dev/sdb6  00:00:00    ( SUCCESS )
         
path: /dev/sdb6
start: 519,178,240
end: 1,953,523,711
size: 1,434,345,472 (683.95 GiB)
check file system on /dev/sdb6 for errors and (if possible) fix them  00:00:00    ( ERROR )
         
e2fsck -f -y -v /dev/sdb6
Ouch.
Quote:
Originally Posted by narnie View Post
Code:
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
Ouch!
Quote:
Originally Posted by narnie View Post
Code:
e2fsck: Group descriptors look bad... trying backup blocks...
e2fsck: Bad magic number in super-block while using the backup blockse2fsck: going back to original superblock
OUCH! Let's just hope fsck decided to give up when it couldn't locate a valid superblock.

The procedure as outlined in the article/blog post is correct:
  1. remove one device from the RAID
  2. expand that device
  3. add it back
  4. repeat 1-3 for all devices
  5. run mdadm --grow to make the RAID device take advantage of the newly available space
The main problem here seems to be that you attempted to resize a device while it was still part of the RAID. /proc/mdstat clearly shows /dev/sdb6 as an active component. The mdadm --fail command you tried to run would have removed /dev/sda1, but that partition isn't even a part of the array. What were you trying to accomplish?

If you have a degraded RAID 1 array, you should be able to resize (or just recreate) the device that's missing. You can then add it back to the array and once the resync has completed, you can safely remove the other device (/dev/sdb6) and resize the partition (or just delete and recreate it). Finally, add /dev/sdb6 back to the array, resync and run mdadm --grow.

The fact that GParted thinks /dev/sdb6 contains a file system and tries to modify it, is a major problem if you want the contents of the partition to survive the procedure. My suggestion is to forget about GParted and just recreate one device at a time.
 
Old 01-05-2014, 02:59 PM   #3
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Original Poster
Rep: Reputation: 17
First, thank you very much for responding.

Second, that was a mistype. The command I ran was mistyped in as on /dev/sda1 (It was run on /dev/sdb6, sda1 is the raid that failed in the first place in is no longer on the system).

Third, as I mentioned in the OP, I ran:

Code:
mdadm -S /dev/md0
To stop the raid (without failing it first), then tried to resize. I just showed /proc/mdstat when the raid is running to show what the raid looks like (really 1/2 the array since the other drive failed). When I tried to resize with gparted, be assured it was stopped with nothing listed in /proc/mdstat related to this array.

Trying to fail /dev/sdb6 gives the device/resource busy error, even though it is a fresh-booted of gparted live software raid that has not been mounted. There is no fuser or lsof on the gparted-live disk (a sad oversight, IMHO).

In setting up the array, the info I had said on /dev/sdb6 to format it extX (I still like 3). Then add it to the array, do the same with the other = size partition, and then create the array with those 2 drives. Then format the /dev/md0 array as extX (which seemed rather redundant to format it in the first place as ext3 knowing the format as /dev/md0 is what makes it work).

Note: I have all the file I need backed up on /dev/sdb6 and can start over with it if I need to.

Thanks for continued help.

Note: everything is backed up so I can redo the who partition if I really have to, but I would rather grow it.

I booted into my normal OS (Linux Mint Debian) after removing the array from /etc/fstab. This gave me options for lsof and fuser as well as losetup. None showed anything using the device, but I read that none of those can find a kernel module using a device. I don't know how I can detect this, but I'm not sure it would change anything. Also, I double check to make sure /dev/sdb1 wasn't being exported and /dev/md0 and, of course, /dev/sdb1 weren't mounted.

Last edited by narnie; 01-05-2014 at 06:58 PM.
 
Old 01-11-2014, 09:44 PM   #4
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Original Poster
Rep: Reputation: 17
It turns out that the directions actually left out steps. For anyone reading this thread, the step is after removing the offending drive by failing it first with:

Code:
# mdadm /dev/md0 --fail /dev/sda6
where /dev/md0 needs changed to your device as does /dev/sda6.

Then remove it with:

Code:
# mdadm /dev/md0 --remove /dev/sda6
changing the devices to meet your system.

What is left out I'm sure is that the partition needs erased. Then it needs rebuilt with the larger partition. Then added to the array.

Code:
# mdadm /dev/md0 --add /dev/sda6
Let it resync, then repeat on the other array member. I was trying to resize it and keep the info, which was a dumb thought.

I didn't get to follow this procedure because my array wouldn't sync due to a bad sector unrecoverable I/O error, so I had to backup, copy to a brand newly built array which I just created with the partition expanded in the first place.
 
  


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
[SOLVED] software raid: adding "write-intent bitmap" overwrites data on raid device wijte Linux - Software 1 03-27-2013 02:34 PM
Unable to resize software raid DaRkBoDoM Linux - Software 3 11-23-2010 01:40 PM
Software RAID device not recognised netsense Linux - General 3 08-04-2010 12:16 AM
how to resize software RAID partitions? garydale Linux - Server 3 08-25-2009 02:34 PM
LXer: How To Resize RAID Partitions (Shrink & Grow) (Software RAID) LXer Syndicated Linux News 1 05-01-2009 12:02 PM

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

All times are GMT -5. The time now is 01:52 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