Operating System - Linux
1822146 Members
4335 Online
109640 Solutions
New Discussion юеВ

does mdadm support completely detach/break mirror (not replace)

 
ran_li
Regular Advisor

does mdadm support completely detach/break mirror (not replace)

Hello all,

I read the previous threads regarding mdadm here, but that does not answer my question.

I used Diskdruid to mirror all the partitions during the installation (RHEL4) including boot partition. Recently I need to break the mirror and release one of the hard disk, somehow, I would not be able to accomplish that successfully.

I tried to stop the mirror, put it into the faulty mode and remove it, then modify the fstab file, but it did not work.

Somebody here has the experience that can share on how to detach a mirror completely?

Appreciate for any clue.

Regards!
11 REPLIES 11
Ivan Ferreira
Honored Contributor

Re: does mdadm support completely detach/break mirror (not replace)

Do you want to stop using mirror at all?

If you just remove the one disk from the mirror, you will get the same results that if you manually fail all md devices.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
ran_li
Regular Advisor

Re: does mdadm support completely detach/break mirror (not replace)

Hi Ivan,

I read your post before.

Yes I want to stop using the mirror. Is there a way? thanks.

Regards!
Ivan Ferreira
Honored Contributor

Re: does mdadm support completely detach/break mirror (not replace)

Whell, you can simply use the system with the disk removed, your mirror will work degraded, and is equivalent to work with a single disk. Probably, is better to use this way, because in the future, you may add again a disk to restore the redundancy.

If you want to stop using mirror anyway, you should change the grub.conf file and the fstab file to point to their respective hd/sd devices instead of the md devices.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
ran_li
Regular Advisor

Re: does mdadm support completely detach/break mirror (not replace)

Hi Ivan,

Thanks for following this post.

I guess besides your suggestion above, there must be some steps else that I omitted or I could not think of.

I modified the grub.conf and fstab files, unplugged one of the hard disk, but got "Kernel Panic" error, and system won't be able to boot up. I modified the grub.conf and changed back to /dev/md1, this time it will locate the kernel but I need to boot from CD and modify the fstab and grub.conf back ...

before start the services under rc, system runs some command to start the md and do the md check/autorun (something like that), do you have a clue where I can stop it?

Regards!
ran_li
Regular Advisor

Re: does mdadm support completely detach/break mirror (not replace)

above, if I just unplug one hard disk and do nothing else, system will boot to normal as Ivan described, but in md degradation mode.
ran_li
Regular Advisor

Re: does mdadm support completely detach/break mirror (not replace)

above, if I just unplug one hard disk and do nothing else, system will boot to normal as Ivan described, but in md degradation mode. I just want to get rid of this mirror so bad. ;-)
Ivan Ferreira
Honored Contributor

Re: does mdadm support completely detach/break mirror (not replace)

Post the results of:

cat /proc/mdstat
df
cat /etc/fstab
cat /etc/grub.conf
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
ran_li
Regular Advisor

Re: does mdadm support completely detach/break mirror (not replace)

It 's in the degradation mode already.

-bash-3.00$ df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md1 10317752 4611336 5182304 48% /
/dev/md0 194366 11174 173157 7% /boot
/dev/md3 212674928 113079888 88791736 57% /d1
none 1036792 0 1036792 0% /dev/shm
/dev/md5 2063440 36064 1922560 2% /tmp
/dev/md4 6190592 100128 5776000 2% /var

-bash-3.00$ cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda2[1]
10482304 blocks [2/1] [_U]

md2 : active raid1 sda3[1]
4192896 blocks [2/1] [_U]

md3 : active raid1 sda5[1]
216066112 blocks [2/1] [_U]

md4 : active raid1 sda6[1]
6289344 blocks [2/1] [_U]

md5 : active raid1 sda7[1]
2096384 blocks [2/1] [_U]

md0 : active raid1 sda1[1]
200704 blocks [2/1] [_U]

unused devices:

-bash-3.00$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md1 10317752 4611336 5182304 48% /
/dev/md0 194366 11174 173157 7% /boot
/dev/md3 212674928 113079888 88791736 57% /d1
none 1036792 0 1036792 0% /dev/shm
/dev/md5 2063440 36064 1922560 2% /tmp
/dev/md4 6190592 100128 5776000 2% /var

-bash-3.00$ cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/md1 / ext3 defaults 1 1
/dev/md0 /boot ext3 defaults 1 2
/dev/md3 /d1 ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/md5 /tmp ext3 defaults 1 2
/dev/md4 /var ext3 defaults 1 2
/dev/md2 swap swap defaults 0 0
/dev/hdb /media/cdrecorder auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/hda /media/cdrecorder1 auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0


# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/md1
# initrd /initrd-version.img
#boot=/dev/sda1
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS-4 i386 (2.6.9-11.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-11.ELsmp ro root=/dev/md1
initrd /initrd-2.6.9-11.ELsmp.img
title CentOS-4 i386-up (2.6.9-11.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-11.EL ro root=/dev/md1
initrd /initrd-2.6.9-11.EL.img
Ivan Ferreira
Honored Contributor

Re: does mdadm support completely detach/break mirror (not replace)

I would do the following changes, remember to copy the current file to .bak:

/etc/fstab
==========

/dev/sda2 / ext3 defaults 1 1
/dev/sda1 /boot ext3 defaults 1 2
/dev/sda5 /d1 ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/sda7 /tmp ext3 defaults 1 2
/dev/sda6 /var ext3 defaults 1 2
/dev/sda3 swap swap defaults 0 0
/dev/hdb /media/cdrecorder auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/hda /media/cdrecorder1 auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0


grub.conf
=========


# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/md1
# initrd /initrd-version.img
#boot=/dev/sda1
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS-4 i386 (2.6.9-11.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-11.ELsmp ro root=/dev/sda2
initrd /initrd-2.6.9-11.ELsmp.img
title CentOS-4 i386-up (2.6.9-11.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-11.EL ro root=/dev/sda2
initrd /initrd-2.6.9-11.EL.img
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
ran_li
Regular Advisor

Re: does mdadm support completely detach/break mirror (not replace)

Just change fstab and grub.conf will end up with "Kernel panic - not syncing: Attempted to kill init".

This is a workstation borrowed from another team, need to return it now, so I don't have chance to fix it, thanks for all your suggestion above, I guess I still need to seek an opportunity to solve this problem.

If you got a chance to test it, please let me know the steps.

Best Regards!
Stuart Browne
Honored Contributor

Re: does mdadm support completely detach/break mirror (not replace)

Unfortunately, I don't know of any way to remove the filesystem headers that are placed on each of the mirrored parts.

Also, by the looks of it, you created 'partition' based mirror pairs..

I'm unaware of any way to remove them from that state.
One long-haired git at your service...