Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 05-03-2007, 09:48 AM   #1
LQ Newbie
Registered: May 2007
Posts: 2

Rep: Reputation: 0
Can't create partition on mdadm raid5 and images mounted over loopback

Hi all,

I want to create a test environment for learning purposes. This is not a production setup of any kind:

Since I don't have 4 disks to use those to build my raid I want to use 4 files as a block device:

I created 4 files using:

dd if=/dev/zero of=disk0.dd bs=512k count=20
dd if=/dev/zero of=disk1.dd bs=512k count=20
dd if=/dev/zero of=disk2.dd bs=512k count=20
dd if=/dev/zero of=disk3.dd bs=512k count=20
I mounted these files as block devices doing:

losetup /dev/loop0 disk0.dd
losetup /dev/loop0 disk1.dd
losetup /dev/loop0 disk2.dd
losetup /dev/loop0 disk3.dd
I created a raid out of these disks using mdadm (The raid is online and looks healthy):

mdadm --create /dev/md0 --level=5 --raid-devices=4 --auto=part /dev/loop[0123]
I want to create 1 simple primary partition on /dev/md0 so I can format it using ext3.
When doing this with fdisk /dev/md0 I can create the partition but when I write it I get:

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
I can't create that partition, or at lease, I can't activate that partition,.... there is no /dev/md0p1 anywhere.

stopping the raid and reassembling it doesn't work either,....

It could be a problem related to the fact that i'm using the loopback driver,....

So, how can I get a healthy working partition with this setup?

Any opinions about this?
Old 05-03-2007, 01:01 PM   #2
Registered: Mar 2006
Posts: 110

Rep: Reputation: 16
unfortunately, software RAID devices cannot be partitioned like a normal device. There have been patches prepared for doing that stuff, but I dont feel they have made it to standard distros. You have two options here:-

1. Use LVM on RAID devices like, md0, and then you can use it to resize or create partitions.
2. Build some more partitions on the disk drive and assign it to different RAID devices like md0 till md15.

I am wondering why have you created the files and then used it to build the software RAID. You can partition your disk and then build the block device.

Or instead, dont create any partition on md device. simply build the ext3 filesystem on it. e.g.

mke2fs -j /dev/md0

Hope this helps!!
Rahul Khare.
Old 06-11-2011, 01:23 PM   #3
Registered: Sep 2002
Posts: 310

Rep: Reputation: Disabled

Actually you just need to use the offset. Check out this post:


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
raid5 with mdadm does not ron or rebuild adiehl Linux - General 12 07-26-2010 10:01 AM
mdadm and raid5 doorito Linux - Server 16 10-13-2009 08:56 PM
RAID5 using mdadm, how to mount /dev/md0? ggduff Linux - Software 4 11-14-2007 01:59 AM
raid5 through mdadm doorito Linux - Server 1 04-09-2007 09:22 PM
Growing RAID5 with mdadm not working in 2.6.17? Fredde87 Linux - Software 1 08-24-2006 03:45 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:35 AM.

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