* Shrinking a RAID1 device mounted as root?
@ 2004-07-14 15:47 Marlier, Ian
2004-07-14 16:29 ` Mike Tran
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marlier, Ian @ 2004-07-14 15:47 UTC (permalink / raw)
To: linux-raid
Hey all...
I'm looking for some help figuring out how to shrink a RAID1 device
that's mounted as root on a Red Hat system.
The device setup is this:
Raiddev /dev/md0
Device /dev/hda1
Raid-disk 0
Device /dev/hdb1
Raid-disk 1
Hda and hdb are both 36GB ATA hard drives, and each currently has a
partition of about 33GB formatted as Linux RAID autodetect. Each also
has a swap partition.
What I'd like to do is shrink partition 1 on each disk to around 16GB,
and then create a second RAID1, /dev/md1, with a new partition /dev/hda3
and /dev/hdb3 (leaving the swap device alone.)
I booted off a rescue disk with mdadm, resize2fs, fdisk, etc, and I was
able to shrink /dev/md0 down to 16GB.
I then tried to delete /dev/hda1 and /dev/hdb1 using fdisk, and create 2
new equally-sized partitions in the free space created. (/dev/hda1,
/dev/hda3, /dev/hdb1, /dev/hdb3, all type Linux RAID Autodetect).
Because /dev/hd[ab]1 is larger than /dev/md0, and the starting block of
the partitions is the same, the filesystem should remain intact.
However, upon rebooting, I ran into a problem. /dev/md0 cannot be
mounted because of a problem with the superblocks.
I figure that something needs to be done with mdadm to get it to
recognize the "new" /dev/hda1 and /dev/hdb1 as /dev/md0 -- but I don't
want to do a mdadm --create because that will overwrite the filesystem
already on the disks (I think?).
Is this something that mdadm --assemble can do? If so, what switches
need to be fed to the command?
Other suggestions?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Shrinking a RAID1 device mounted as root?
2004-07-14 15:47 Shrinking a RAID1 device mounted as root? Marlier, Ian
@ 2004-07-14 16:29 ` Mike Tran
2004-07-14 16:42 ` Paul Clements
2004-07-14 16:44 ` Guy
2 siblings, 0 replies; 4+ messages in thread
From: Mike Tran @ 2004-07-14 16:29 UTC (permalink / raw)
To: linux-raid
On Wed, 2004-07-14 at 10:47, Marlier, Ian wrote:
> Hey all...
>
> I'm looking for some help figuring out how to shrink a RAID1 device
> that's mounted as root on a Red Hat system.
>
> The device setup is this:
> Raiddev /dev/md0
> Device /dev/hda1
> Raid-disk 0
> Device /dev/hdb1
> Raid-disk 1
>
> Hda and hdb are both 36GB ATA hard drives, and each currently has a
> partition of about 33GB formatted as Linux RAID autodetect. Each also
> has a swap partition.
>
> What I'd like to do is shrink partition 1 on each disk to around 16GB,
> and then create a second RAID1, /dev/md1, with a new partition /dev/hda3
> and /dev/hdb3 (leaving the swap device alone.)
>
> I booted off a rescue disk with mdadm, resize2fs, fdisk, etc, and I was
> able to shrink /dev/md0 down to 16GB.
>
> I then tried to delete /dev/hda1 and /dev/hdb1 using fdisk, and create 2
> new equally-sized partitions in the free space created. (/dev/hda1,
> /dev/hda3, /dev/hdb1, /dev/hdb3, all type Linux RAID Autodetect).
> Because /dev/hd[ab]1 is larger than /dev/md0, and the starting block of
> the partitions is the same, the filesystem should remain intact.
>
> However, upon rebooting, I ran into a problem. /dev/md0 cannot be
> mounted because of a problem with the superblocks.
>
> I figure that something needs to be done with mdadm to get it to
> recognize the "new" /dev/hda1 and /dev/hdb1 as /dev/md0 -- but I don't
> want to do a mdadm --create because that will overwrite the filesystem
> already on the disks (I think?).
>
> Is this something that mdadm --assemble can do? If so, what switches
> need to be fed to the command?
>
> Other suggestions?
>
>
If your newly created partitions are > 16GB as stated, you should be
able to recreate raid1 md0 using mdadm via your rescue disk. After the
re-sync completes, you can reboot the machine. Remember, raid1 is
mirroring :)
Regards,
Mike T.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Shrinking a RAID1 device mounted as root?
2004-07-14 15:47 Shrinking a RAID1 device mounted as root? Marlier, Ian
2004-07-14 16:29 ` Mike Tran
@ 2004-07-14 16:42 ` Paul Clements
2004-07-14 16:44 ` Guy
2 siblings, 0 replies; 4+ messages in thread
From: Paul Clements @ 2004-07-14 16:42 UTC (permalink / raw)
To: Marlier, Ian; +Cc: linux-raid
Marlier, Ian wrote:
> Because /dev/hd[ab]1 is larger than /dev/md0, and the starting block of
> the partitions is the same, the filesystem should remain intact.
So you are saying that the filesystem was less than 16GB in size to
start with?
> However, upon rebooting, I ran into a problem. /dev/md0 cannot be
> mounted because of a problem with the superblocks.
Right, the superblocks would have been between 64KB and 128KB from the
end of the original md device, which presumably was ~33GB in size. Now
that the partitions are smaller, the superblocks are no longer located
inside of the partitions, so the new partitions effectively have no
superblocks.
> I figure that something needs to be done with mdadm to get it to
> recognize the "new" /dev/hda1 and /dev/hdb1 as /dev/md0 -- but I don't
> want to do a mdadm --create because that will overwrite the filesystem
> already on the disks (I think?).
Create will write new superblocks to /dev/hda1 and /dev/hdb1. Without
these, the array cannot be started. The superblocks are what tell the md
driver that /dev/md0 is composed of /dev/hda1 and /dev/hdb1.
If the filesystem is at least 128KB smaller than the partitions, then
you'll have room for the superblocks at the end. Otherwise, go back with
fdisk and make the partitions just a little bit larger and then do your
mdadm --create.
> Is this something that mdadm --assemble can do? If so, what switches
> need to be fed to the command?
Assemble requires that the superblocks already be present, so until they
are re-created, you cannot assemble the array.
--
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Shrinking a RAID1 device mounted as root?
2004-07-14 15:47 Shrinking a RAID1 device mounted as root? Marlier, Ian
2004-07-14 16:29 ` Mike Tran
2004-07-14 16:42 ` Paul Clements
@ 2004-07-14 16:44 ` Guy
2 siblings, 0 replies; 4+ messages in thread
From: Guy @ 2004-07-14 16:44 UTC (permalink / raw)
To: 'Marlier, Ian', linux-raid
The superblock is at the end of the partition. If the size is different, md
will not find the superblock.
Guy
-----Original Message-----
From: linux-raid-owner@vger.kernel.org
[mailto:linux-raid-owner@vger.kernel.org] On Behalf Of Marlier, Ian
Sent: Wednesday, July 14, 2004 11:48 AM
To: linux-raid@vger.kernel.org
Subject: Shrinking a RAID1 device mounted as root?
Hey all...
I'm looking for some help figuring out how to shrink a RAID1 device
that's mounted as root on a Red Hat system.
The device setup is this:
Raiddev /dev/md0
Device /dev/hda1
Raid-disk 0
Device /dev/hdb1
Raid-disk 1
Hda and hdb are both 36GB ATA hard drives, and each currently has a
partition of about 33GB formatted as Linux RAID autodetect. Each also
has a swap partition.
What I'd like to do is shrink partition 1 on each disk to around 16GB,
and then create a second RAID1, /dev/md1, with a new partition /dev/hda3
and /dev/hdb3 (leaving the swap device alone.)
I booted off a rescue disk with mdadm, resize2fs, fdisk, etc, and I was
able to shrink /dev/md0 down to 16GB.
I then tried to delete /dev/hda1 and /dev/hdb1 using fdisk, and create 2
new equally-sized partitions in the free space created. (/dev/hda1,
/dev/hda3, /dev/hdb1, /dev/hdb3, all type Linux RAID Autodetect).
Because /dev/hd[ab]1 is larger than /dev/md0, and the starting block of
the partitions is the same, the filesystem should remain intact.
However, upon rebooting, I ran into a problem. /dev/md0 cannot be
mounted because of a problem with the superblocks.
I figure that something needs to be done with mdadm to get it to
recognize the "new" /dev/hda1 and /dev/hdb1 as /dev/md0 -- but I don't
want to do a mdadm --create because that will overwrite the filesystem
already on the disks (I think?).
Is this something that mdadm --assemble can do? If so, what switches
need to be fed to the command?
Other suggestions?
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-14 16:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-14 15:47 Shrinking a RAID1 device mounted as root? Marlier, Ian
2004-07-14 16:29 ` Mike Tran
2004-07-14 16:42 ` Paul Clements
2004-07-14 16:44 ` Guy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).