LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   RAID1 swap disappearing? (http://www.linuxquestions.org/questions/slackware-14/raid1-swap-disappearing-770692/)

tunkaflux 11-21-2009 04:23 PM

RAID1 swap disappearing?
 
Hello,

I've got a server with Slackware64 13.0 installed. It has 2 disks in it configured for RAID1 (1 root partition & 1 swap partition on each disk in RAID1: /dev/md0 & /dev/md1). For some reason, the box became unresponsive and after I rebooted it, swap seems to be gone. There's no /dev/md1 anymore and for some reason Slack is resyncing /dev/md0 starting from 0%...
I was not able to find any specific errors in the log files.

Does anyone have an idea on why /dev/md1 is gone and why it's resynching /dev/md0?

Tnx

mRgOBLIN 11-21-2009 08:28 PM

Normally you don't raid your swap partitions.

You set the swap partitions to type 82 and add them to fstab as normal.

Something like this

Code:

/dev/sdc1        swap            swap        pri=1            0  0
/dev/sdd1        swap            swap        pri=1            0  0
/dev/md0        /                ext3        defaults        1  1

You can check the status of your raid with
Code:

mdadm -D /dev/md[01]

tunkaflux 11-22-2009 03:12 AM

Quote:

Originally Posted by mRgOBLIN (Post 3765316)
Normally you don't raid your swap partitions.

You set the swap partitions to type 82 and add them to fstab as normal.

Something like this

Code:

/dev/sdc1        swap            swap        pri=1            0  0
/dev/sdd1        swap            swap        pri=1            0  0
/dev/md0        /                ext3        defaults        1  1

You can check the status of your raid with
Code:

mdadm -D /dev/md[01]

In this case, what happens when swap is in use and one of the disks fails?

Shingoshi 11-22-2009 03:32 AM

RAID0: To get a faster swap...
 
Quote:

Originally Posted by mRgOBLIN (Post 3765316)
Normally you don't raid your swap partitions.

Actually, you can RAID your swap partitions. I almost always use swap on RAID. But you should be using RAID0 instead for speed. The more disks you have in your RAID0 swap, the faster your system will be. And preferably, put those partitions on the outer edges of your disks, which are moving faster to give decreased access times. Swap doesn't need redundancy. But it does benefit from the increased speed that RAID0 will give you.

Xavian-Anderson Macpherson
Shingoshi

tunkaflux 11-22-2009 04:09 AM

Quote:

Originally Posted by Shingoshi (Post 3765489)
Actually, you can RAID your swap partitions. I almost always use swap on RAID. But you should be using RAID0 instead for speed. The more disks you have in your RAID0 swap, the faster your system will be. And preferably, put those partitions on the outer edges of your disks, which are moving faster to give decreased access times. Swap doesn't need redundancy. But it does benefit from the increased speed that RAID0 will give you.

Ok, but I don't care about speed, I care about reliability, stability & uptime :) What happens when 1 disk, which contains parts of your RAID0 swap, completely fails whilst this is in use?

Shingoshi 11-22-2009 04:22 AM

If that's what you value most...
 
Quote:

Originally Posted by tunkaflux (Post 3765505)
Ok, but I don't care about speed, I care about reliability, stability & uptime :) What happens when 1 disk, which contains parts of your RAID0 swap, completely fails whilst this is in use?

Then I would definitely say go ahead and use it. Because it is a good point. If you have more than two disks, then use RAID5. You'll have your redundancy and speed along with it.

Xavian-Anderson Macpherson
Shingoshi

tunkaflux 11-22-2009 05:41 AM

In the meantime, /dev/md0 (root) has resynced and after that it seems /dev/md1 has also resynced (swap).

However, swap was not automatically turned on, I had to manually do "swapon -a". Is this normal?

tux_dude 11-22-2009 09:44 AM

How is the raid drive setup? Are these IDE, sata or scsi? What type of drives are they? You should check if there are any know issues with the drives and RAID.

Is seems one of the drive stops responding causing mdadm to treat it as a failure. This can occur if the drive goes to sleep, become non-responsive when flushing cache (Seagate had the problem) or on the same IDE cable. Run a full smartctl on both disks. You can then use hdparm to tweak the drive settings.

mRgOBLIN 11-22-2009 09:01 PM

Quote:

Originally Posted by Shingoshi (Post 3765489)
Actually, you can RAID your swap partitions. I almost always use swap on RAID. But you should be using RAID0 instead for speed.
Shingoshi

What a load of....

I never said you couldn't swap on raid...

If you are headed into swap why would you add the overhead of raid0 onto that for no benefit?

Setting the swap priority the same for each partition will let the kernel "stripe" across the swap partitions... and is way more efficient.

Quote:

Originally Posted by tunkaflux (Post 3765505)
In this case, what happens when swap is in use and one of the disks fails?

It's called a "Really Bad Day"(TM). =)

Yes it could crash the machine but after a re-boot, your system should come back fine. (less that swap partition).

If uptime is extremely important then of course raid the swap (just don't use raid0). You might also be better off looking at proper battery backed hardware raid too.

Shingoshi 11-22-2009 09:32 PM

Do you feel like a BIGGER man now??
 
Quote:

Originally Posted by mRgOBLIN (Post 3766215)
What a load of....

I never said you couldn't swap on raid...

If you are headed into swap why would you add the overhead of raid0 onto that for no benefit?

Setting the swap priority the same for each partition will let the kernel "stripe" across the swap partitions... and is way more efficient.

Was it that difficult to say this without being insulting? Frankly I knew nothing about the swap priority. I missed the information you gave about setting the swap priority in your first post. Thanks for having posted it! Hopefully others won't miss it also.

EDIT: I have now followed your good advice!
1.) I first had to "swapoff -a" to dump all memory.
2.) Then I went into Webmin and deleted those partitions.
3.) Followed by reformatting them as Linux 82 (Hardware/Partitions on Local Disks),...
4.) and remounting and activating them in the "Disk and Network Filesystems" tab under System.

Works fine now as you can see.
Code:

sh-4.0# free -mlt
            total      used      free    shared    buffers    cached
Mem:          7720      7429        291          0          0      1552
Low:          7720      7429        291
High:            0          0          0
-/+ buffers/cache:      5875      1845
Swap:        3812          0      3812
Total:      11533      7429      4103

Xavian-Anderson Macpherson
Shingoshi


All times are GMT -5. The time now is 07:27 PM.