LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-29-2007, 10:41 PM   #1
rgreeves
Member
 
Registered: Sep 2006
Location: Tucson, Az.
Distribution: hardy heron
Posts: 111

Rep: Reputation: 15
linux swap partition problem


P4, 2 80gb drives in raid1, 1gb mem

Had a bad swap partition on one drive. Using gparted I copied a good swap to the bad drive. Neither swap partition is active now. Tried swapon from gparted as well as the console and got a "invalid argument" each time.

I have no swap and my system is struggling. How do I activate these swap partitions?

Sure could use some help.....
 
Old 10-29-2007, 11:14 PM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
You have a whole gig of ram and your system needs swap??

# echo 0 > /proc/sys/vm/swappiness

Of course, while this is probably what you need, it doesn't answer your question.

Quote:
Had a bad swap partition on one drive.
What was it about the partition that made it "bad"?
Quote:
Using gparted I copied a good swap to the bad drive.
"copied"?? Why not use gparted to re-create the swap partition?
Quote:
Neither swap partition is active now.
... this is a real puzzle. Have you seen:
http://lissot.net/partition/partition-08.html
... check your /etc/fstab against fdisk -l to make sure the swap partitions are correctly entered. (Show me if you got confused or uncertain.)

If you really need swap, then you should create a swap file while troubleshooting.
dd if=/dev/zero of=/var/my_swap bs=1024 count=131072
and activate it
mkswap -f /var/my_swap
swapon /var/my_swap
 
Old 10-29-2007, 11:30 PM   #3
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
A lot of us with 2gb of ram still need swap. It just depends on what you are doing.

Other than that I am with Simon.
 
Old 10-30-2007, 12:54 AM   #4
rgreeves
Member
 
Registered: Sep 2006
Location: Tucson, Az.
Distribution: hardy heron
Posts: 111

Original Poster
Rep: Reputation: 15
I'm sure I am confusing things. Here is what I know. My screen on occasion would gray out while an operation was going on and if you watched the system monitor in the upper panel it would be full. When the system caught up the gray would go away. I wondered what was going on thus I ran gparted to check out my Raid drives. /dev/sda showed that there was an alert symbol in the swap partition. Basically the swap partition was not in use or corrupt. The other drive was ok. I experimented and copied the "good" swap partition in /dev/sdb to /dev/sda. Confused yet? Now both partitions will not respond to the swapon command and issue a "invalid argument.

So I'd like to return the system to normal.

Why swap? That is how someone set it up for me.

See below;

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00051b2f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 6687 53713296 fd Linux raid autodetect
/dev/sda2 6688 9605 23438835 fd Linux raid autodetect
/dev/sda3 9606 9702 779152+ 82 Linux swap / Solaris

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 6687 53713296 fd Linux raid autodetect
/dev/sdb2 6688 9605 23438835 fd Linux raid autodetect
/dev/sdb3 9606 9702 779152+ fd Linux raid autodetect

Disk /dev/md0: 55.0 GB, 55002333184 bytes
2 heads, 4 sectors/track, 13428304 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

Disk /dev/md1: 24.0 GB, 24001249280 bytes
2 heads, 4 sectors/track, 5859680 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table
 
Old 10-30-2007, 06:08 PM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
There is only one swap partition in there dude. Check with /etc/fstab to see how it is mounted.
Quote:
Now both partitions will not respond to the swapon command and issue a "invalid argument.
Use

swapoff -a then swapon -a

Quote:
the system monitor in the upper panel it would be full
... hmmm, in my system monitor, the upper panel is for CPU useage. The middle panel is memory with a trace for swap and another for RAM. Mine is sitting around 50% swap and 70% RAM (512MiB) and the cpu barely cracks 2% with swappiness 10.

But what you seem to be reporting is max cpu load, not maxed out swap. However, if you see maxed out RAM and no swap use... make a swap file to use in the interim.

Quote:
Disk /dev/md1 doesn't contain a valid partition table
But, basically: you need to repair your RAID.
The purpose of your RAID appears to be to increase read/write speed on a single drive. Now it is bad, this speed will be incredibly slow.

Maintaining Linux RAID
http://www.samag.com/documents/s=910...404a/0404a.htm

Related thread
http://www.linuxquestions.org/questi...-linux-412510/

I normally encorage a rethink about why you need RAID.

Last edited by Simon Bridge; 10-30-2007 at 06:10 PM.
 
Old 10-31-2007, 09:09 AM   #6
rgreeves
Member
 
Registered: Sep 2006
Location: Tucson, Az.
Distribution: hardy heron
Posts: 111

Original Poster
Rep: Reputation: 15
Actually I would like to revert to a single drive with some sort of scheme to use the second drive as a backup. Perhaps there is a howto that would assist me in doing that.

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/md0 / ext3 defaults,errors=remount-ro 0 1
/dev/md1 /dvdbackup ext3 defaults 0 1
/dev/md2 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/scd1 /media/dvd+rw udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
/dev/sda /media/usb0 auto rw,user,noauto 0 0
/dev/sdb /media/usb1 auto rw,user,noauto 0 0

Last edited by rgreeves; 10-31-2007 at 09:21 AM.
 
Old 11-01-2007, 11:42 AM   #7
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Yeah - you backup and reinstall.

I've been lazy and run cp with the archive flag to backup my /home directory. Used to have a more elaborate method involving tar, which supports incremental backups too.

Good luck.
 
Old 11-04-2007, 10:21 PM   #8
rgreeves
Member
 
Registered: Sep 2006
Location: Tucson, Az.
Distribution: hardy heron
Posts: 111

Original Poster
Rep: Reputation: 15
actually, is there a way to get the swap working on one drive then I can reformat the other one?
 
Old 11-05-2007, 06:19 AM   #9
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
If you are trying to reconstruct the data of the swap partition. Forget it. Just run mkswap on the swap partition and then use swapon to activate the swap partition. To ease mounting swap partitions or any other partition from a SCSI drive, I suggest specify a label while formating.

If the partition table information has strange start and end values for the swap partition, then backup the data on all partitions and edit the partitions.

If someone setup for you, then they do not know anything about Linux. For one thing software RAID from the controller is not reliable and stable in Linux. I recommend use Linux software RAID instead. The CD drive is /dev/hdX or /dev/sdX. A device node /dev/scd is the old way using SCSI emulation for IDE optical drives. Also USB storage devices needs a partition number because it can not mount RAW partitions such as /dev/sda. I do not recommend including USB and IEEE-1394 storage mediums in /etc/fstab because it will create confusion and unpredictable problems. I recommend use dbus, hal, or udev to help mount USB and IEEE-1394 storage devices.
 
Old 11-18-2007, 02:51 PM   #10
rgreeves
Member
 
Registered: Sep 2006
Location: Tucson, Az.
Distribution: hardy heron
Posts: 111

Original Poster
Rep: Reputation: 15
this was a software raid1 setup. dev/sda swap partition went bad. I replaced it by deleting the bad one and using gparted replaced it. The new swap partition is not showing it as being a raid swap partition. Confused? Me too.

see below

$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sda3[1]
779072 blocks [2/1] [_U]

md1 : active raid1 sda2[0] sdb2[1]
23438720 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
53713216 blocks [2/2] [UU]

unused devices: <none>

Last edited by rgreeves; 11-18-2007 at 02:53 PM.
 
  


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
problem loading swap partition fluttters Mandriva 5 02-03-2006 03:11 PM
Problem resizing swap partition linuxlimbo SUSE / openSUSE 6 01-02-2006 08:16 PM
problem with lacking of swap partition ntduongntd Linux - General 1 11-28-2004 10:45 AM
swap partition problem jaysan Linux - Newbie 3 03-24-2002 06:16 PM
installation - partition / swap problem catch Linux - Software 3 03-10-2002 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:48 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