LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-28-2006, 10:40 PM   #1
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
RAID 1 swap device does not start automatically upon restart


I have 2 harddisks, sda and sdb.

/dev/md0 consists of sda2 and sdb2, mounted as /

I have created /dev/md1 consisting of two swap partitions, /dev/sda1 and /dev/sdb1, with the following:

# mdadm --create /dev/md1 -l1 -n2 -x0 /dev/sda1 /dev/sdb1
# mkswap /dev/md1

Then I edit /etc/fstab to add the following:

/dev/md1 none swap sw 0 0

# swapon -a

Following which, I edit the /etc/mdadm/mdadm.conf with

# rm /etc/mdadm/mdadm.conf
# mdadm --detail --scan > /etc/mdadm/mdadm.conf
# MAILADDR root >> /etc/mdadm/mdadm.conf

After I reboot, the swap (/dev/md1) is active. However, if I unplug one of the disk (sda) to test if the RAID works, the system still boot (I've installed GRUB on the both harddisks), but the swap (/dev/md1) is not active.

How should I go about enabling /dev/md1 to activate on boot when one of the disk is unplugged?

Thanks !
 
Old 08-28-2006, 10:42 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
I could be wrong when I say this but I am not sure that the swap works like that.
 
Old 08-28-2006, 11:08 PM   #3
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
In my original post, I'm trying to configure the swap such that if one of the disks fail, the remaining disk will have a swap to work with.

If that is not the way it should be configured, please advise.

Thanks, much appreciated.


Quote:
Originally Posted by jstephens84
I could be wrong when I say this but I am not sure that the swap works like that.

Last edited by Akhran; 08-28-2006 at 11:49 PM.
 
Old 08-29-2006, 12:14 AM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
I was wrong. Check out this website and tell me if this is what your trying to do. Apparently you have to tell /etc/fstab to use the swap on another driver.
 
Old 08-29-2006, 08:38 AM   #5
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
That is a very good link.

Thank you.

Quote:
Originally Posted by jstephens84
I was wrong. Check out this website and tell me if this is what your trying to do. Apparently you have to tell /etc/fstab to use the swap on another driver.
 
Old 08-29-2006, 10:45 AM   #6
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
I found that very useful. I started to read and was thinging to myself, I may do something like this on my new workstation I am building. So I decided to bookmark.
 
Old 10-11-2006, 11:32 AM   #7
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
It seems that the website advises using RAID for Swap for high availability. Back to my first post, how should I go about enabling /dev/md1 to activate on boot when one of the disk is unplugged?

Nevertheless, it is a good link. Thanks.

Quote:
Originally Posted by jstephens84
I found that very useful. I started to read and was thinging to myself, I may do something like this on my new workstation I am building. So I decided to bookmark.
 
Old 10-11-2006, 05:52 PM   #8
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
don't know how. When I get it working I will post the information. It may require some kind of script to check drive avaliablity. If it is then use this one for swap. If not then use this drive. That is what I was sort of thinking in terms of how I would write the script.
 
Old 10-11-2006, 06:45 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,439

Rep: Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066
If /dev/md1 is still there after disconnecting the drive, swap should use it. Simple as that I would have thought.
What does dmesg show after the reboot ???.
Does swapon after the reboot work ???.

(Note, no experience of RAID,just concepts on my behalf)
 
  


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
restart after loading swap in booting fluttters Linux - Newbie 1 01-29-2006 11:21 AM
Automatically Restart Service tulip4heaven Linux - General 1 04-23-2005 03:11 AM
Way to automatically restart a program? AlexV Linux - General 1 04-13-2005 06:23 PM
Automatically Restart Server?? flamesrock Linux - Software 4 08-07-2004 10:25 PM
kernel automatically restart if there is a panic kernelpanicguy Linux - Software 3 07-29-2003 10:06 PM


All times are GMT -5. The time now is 11:24 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration