LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 09: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, 09:42 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
I could be wrong when I say this but I am not sure that the swap works like that.
 
Old 08-28-2006, 10: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 10:49 PM.
 
Old 08-28-2006, 11:14 PM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
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, 07: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, 09:45 AM   #6
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
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, 10: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, 04:52 PM   #8
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
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, 05:45 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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



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 10:21 AM
Automatically Restart Service tulip4heaven Linux - General 1 04-23-2005 02:11 AM
Way to automatically restart a program? AlexV Linux - General 1 04-13-2005 05:23 PM
Automatically Restart Server?? flamesrock Linux - Software 4 08-07-2004 09:25 PM
kernel automatically restart if there is a panic kernelpanicguy Linux - Software 3 07-29-2003 09:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:08 PM.

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