Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-29-2006, 04:21 PM
|
#1
|
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519
Rep:
|
Old PC forgets about it's own swap partition & mount it. Need help to write a script
Hi all,
For some reason, over the last two weeks my swap partition on dev/hda2 does not get mounted. On bootup before I even get to /etc/rc.d/rc.pcmcia in the boot process, I sometimes get the warning 'unable to find swap space signature' and therefore the pc does activate the 'swapon /dev/hda2'
I verify this is happening by typing 'top' in console.
Once I type 'mkswap /dev/hda2' then 'swapon /dev/hda2' I'm fine.
Is there a way that I can write a script to verify the existence of the swap partition, and if it does not do this then it will type those commands out for me?
I totally dumped the hard drive, I ran a 'debug script' too. Then reloaded, and it still happens, let's say 1 out of every 2 boots.
I do have the swap file correctly keyed into my etc/fstab.
Any thoughts on how I make a script to check this out for me?
thank you in advance.
|
|
|
06-29-2006, 04:49 PM
|
#2
|
Member
Registered: Apr 2005
Distribution: Exherbo
Posts: 474
Rep:
|
you could make a script to check "free" and find out if you have any swap. If you dont see any swap then you can turn the swap on.
Another thing, you mention both swap file and swap partition in your post....which one is it(they are most different)? I am led to believe it is a partition, but still....
<<Samoth>>
|
|
|
06-29-2006, 06:28 PM
|
#3
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
|
You can use /proc/swaps to see if swap is activated. Try a script like this:
Code:
#!/bin/sh
if grep -q "/dev/hda2" /proc/swaps; then
echo "swap already ok"
else
/sbin/swapon -a
echo "swap is now ok"
fi
If you need to re-format /dev/hda2, add "/sbin/mkswap /dev/hda2" before swapon.
Regards
|
|
|
06-29-2006, 07:14 PM
|
#4
|
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519
Original Poster
Rep:
|
samoth: you are correct, i said swap file near the end of my post there initially. I did mean "swap partition on /dev/hda"
bathory: i'll give it a shot in a little while and report back.
thanks guys.,
|
|
|
06-30-2006, 01:39 PM
|
#5
|
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519
Original Poster
Rep:
|
Wouldn't you know I've rebooted this pc about 10 times, and it hasn't forgotten to add the swap partition so I cant verify if the fix works yet or not. LOL
I tell ya, sometimes computers have minds all their own.
|
|
|
06-30-2006, 11:52 PM
|
#6
|
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519
Original Poster
Rep:
|
bathory I made a *.sh file and told my /etc/rc.d/rc.local file to execute it on loading up.
I typed out exactly what you had there and also chmod it too.
Finally today, it booted up and did NOT see the swap partition, but it still said "swap already ok" like the script calls for.
I think it is not accurately checking the status of the existence of an active swap partition.
Any other ideas how the script could properly detect the status/existence accurately of the swap partition?
Or did I put my script in the wrong place?
Thank you again.
|
|
|
07-01-2006, 08:35 AM
|
#7
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
|
When you say you didn't saw the swap partition, what is the output of:
And what happens if you run the script manually when you see no swap partition?
|
|
|
07-01-2006, 10:12 AM
|
#8
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,961
|
Quote:
Originally Posted by Old_Fogie
bathory I made a *.sh file and told my /etc/rc.d/rc.local file to execute it on loading up.
I typed out exactly what you had there and also chmod it too.
Finally today, it booted up and did NOT see the swap partition, but it still said "swap already ok" like the script calls for.
I think it is not accurately checking the status of the existence of an active swap partition.
Any other ideas how the script could properly detect the status/existence accurately of the swap partition?
Or did I put my script in the wrong place?
Thank you again.
|
Hi,
How about running some HD diagnosis!
What is the output of;
Code:
#hdparm -I /dev/hd? #replace ? with your device
|
|
|
07-03-2006, 12:48 AM
|
#9
|
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519
Original Poster
Rep:
|
cat /proc/swaps gives me the following IF the swap partition is activated upon boot:
Filename Type Size Used Priority
/dev/hda2 partition 514072 668 -1
and the hdparm -i /dev/hda gives me:
Model=TOSHIBA MK6409MAV, FwRev=F5.01 A, SerialNo=
Config={ Fixed }
RawCHS=13424/15/63, TrkSize=0, SectSize=0, ECCbytes=36
BuffType=unknown, BuffSize=0kB, MaxMultSect=16, MultSect=16
CurCHS=13424/15/63, CurSects=12685680, LBA=yes, LBAsects=12685680
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: sdma0 sdma1 sdma2 mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 *udma2
AdvancedPM=no WriteCache=enabled
Drive conforms to: device does not report version: 1 2 3 4
* signifies the current active mode
|
|
|
07-03-2006, 03:47 AM
|
#10
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
|
The script should work (I've tested it by deactivating my swap partitionan then runing the script to re-activate it). If swap is not activated then /proc/swaps is empty, else it contains what you've posted. I suggest you to remove it from rc.local and run it manually when you see no swap space to see what happens.
|
|
|
07-08-2006, 06:19 AM
|
#11
|
Senior Member
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,519
Original Poster
Rep:
|
Hi bathory,
I found in the /etc/rc.d/rc.0 script some "sleep" times related to turning off the local hard drives, turning off swap, and performing something called "sync".
Anyway, I just increased the sleep times, actually I just double all of them, and so far so good.
So far it looks like that may?? have been my issue on this old slow laptop. I'll post back if the issue rears it's ugly head, but so far so good. Thank you again for your replies, it is really appreciated.
|
|
|
All times are GMT -5. The time now is 03:34 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|