LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Swap Fails on Boot Up (https://www.linuxquestions.org/questions/linux-general-1/swap-fails-on-boot-up-831416/)

carlosinfl 09-10-2010 11:45 AM

Swap Fails on Boot Up
 
Maybe what I am trying to do doesn't work but let me explain. I have two identical drives on my PC.

/dev/sda = 1 TB
/dev/sdb = 1 TB

I wanted to mirror the drives so I created two separate partitions on each drive:

sda1 = 1024 MB (Swap)
sda2 = 999 GB (Software RAID)

sdb1 = 1024 (Swap)
sdb2 = 999 GB (Software RAID)

I then only created /dev/md0 which consist of /dev/sda2 & /dev/sdb2 in RAID 1 mirror.

When I boot the system, I show that Swap fails during boot in bright 'red' letters. I don't know if it failed activating both or just any swap partitions in general. When I look at 'df -h' while my system is booted, I show:

Code:

[root@buster ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
udev                  10M  168K  9.9M  2% /dev
/dev/md0              997G  847M  992G  1% /
shm                  997M    0  997M  0% /dev/shm

Does this mean that only 1 swap partition activated successfully and the 2nd one failed? Should I mirror the two swap partitions into /dev/md1?

Please help!

MensaWater 09-10-2010 12:11 PM

df doesn't show information about swap. The /dev/shm is a special mount for shared memory.

To see swap information type "swapon -s".

For swap partitions to work:
1) When you create the partition it must be identified as swap (not Linux RAID Autodetect like your other partition).
2) mkswap has to be run on the device to make it a swap device.
3) The device has to be added as swap with the swapon command (if done after the system is up) and/or added to /etc/fstab to make it be enabled as swap at boot for example
/dev/sda1 swap swap defaults 0 0
/dev/sdb1 swap swap defaults 0 0

carlosinfl 09-10-2010 05:30 PM

I checked as you noted and I don't see any active 'swap' partitions active...

Code:

[root@buster ~]# swapon -s
Filename                                Type                Size        Used        Priority

How do you recommend I fix this problem?

MensaWater 09-13-2010 01:32 PM

As noted in my post:

You have to make sure the partition type is linux swap (type fdisk -l to see all your partitions). If they're not you can use fdisk to change them (type "man fdisk" for details).

You have to use the mkswap to format them as swap devices (type "man mkswap" for details").

You can use the swapon command to enable them if the system is up already after you've created them as noted above. (See "man swapon" for details).

Add them to /etc/fstab as noted above to insure they get re-enabled on reboot.


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