Link to home
Start Free TrialLog in
Avatar of visualminder
visualminder

asked on

System frozen by continuous harddisk-reading

Hi Experts,

I have this problem for quite a long time.
Each time when I start my linux machine, it works quite stable in the first few hours. And then it begins to read/write the harddisk continuously. At the same time it response neither the mouse clicking nor the keyboard typing. I must restart the computer to get it to work in the next few hours :-(
Cann anybody tell me how should I do about it?

Some additional informations:
I use SUSE Linux 7.2, Kernel 2.4
I have 2 Harddisks in my machine, one for windows, one for linux.
The Harddisk for windows is full.
The one for linux has still capacity.

/dev/hda1-hda6    Windows

/dev/hdb1 ext2 23Mb  /boot  free:18.3M  
/dev/hdb3 ext2 9.14Gb  /    free:2.46G

Should I establish a swap partition? Can I do it on the hdb3?

Thanks a lot

Visu

Avatar of jlevie
jlevie

No swap partition, huh? That could be the cause of the disk activity since it starts after the system has been up for a while.

Adding a swap partition would be the preferred way, but unless you have unallocated space on hdb that won't be an easy thing to do. You'd have to squeeze your root partition if you tried to do it on the existing installation or reinstall the os and include a swap partition in the new configuration.

An alternative would be to make a swap file on the existing installation. The file would be created with dd, made into a swap file with mkswap, and enabled with swapon. Something along the lines of:

# dd if=/dev/zero of=/swapfile bs=1024 count=???
# mkswap /swapfile
# swapon /swapfile

The count=??? should be at least 1024 x your memory size in MB, and more, say around twice the amount of memory, is even better. If that solves the disk thrashing problem you'll want to arrainge to have the swap area enabled at boot, see "man fstab". Or you could consider the more troublesome options above.
Avatar of visualminder

ASKER

Hi Jlievie,

thanks for the anwser.
As I tried to setup a swap partition with the partition magic, I noticed that I did have a small swap partition of 136M. It should be too small for my machine (256M memory). By using the partition magic I firstly remove the swap partition and add another 430M to it to form a larger free space. Then I changed to Linux and setup this free space to be a swap partition:
/dev/hdb2  (from) 4   (to) 74   570M

But as I run "top" to see the result,the system reported:  
Swap: 136M available   93M used   43M free  173M cached

Why only 136M available?? Any idea?

Thanks

Visu
Hi Jlievie,

thanks for the anwser.
As I tried to setup a swap partition with the partition magic, I noticed that I did have a small swap partition of 136M. It should be too small for my machine (256M memory). By using the partition magic I firstly remove the swap partition and add another 430M to it to form a larger free space. Then I changed to Linux and setup this free space to be a swap partition:
/dev/hdb2  (from) 4   (to) 74   570M

But as I run "top" to see the result,the system reported:  
Swap: 136M available   93M used   43M free  173M cached

Why only 136M available?? Any idea?

Thanks

Visu
I don't understand what you mean by "Then I changed
to Linux and setup this free space to be a swap partition:
/dev/hdb2  (from) 4   (to) 74   570M". Did the partition number of your swap partition remain the same? If it didn't did you change /etc/fstab?

Even though Partition Magic may have increased the size of the partiton that swap is using, Linux won't use the additional space until mkswap has been run on that area. I'd recommend that you re-make the swap partition by booting into single user mode and then doing:

# swapoff -a
# mkswap /dev/hd??
# swapon -s

You've probably got enough memory to do the above in runlevel 3, but why take a chance on something needing swap while you are re-making it. Single user mode is much safer.
I used a tool called "yast" under suse Linux 7.2 to set the 570M freespace to the swap. The setup seemed to be successful. After the setup the tool reported:

device-name   from  to   Kbytes  type of the partition
/dev/hdb1       1    3    24066    83 Linux native
/dev/hdb2       4    74   570307   82 Linux Swap
/dev/hdb3      75   1232  9301635  83 Linux native

I think that means I have then 570M capacity for the swap.
But another linux tool "top" reported in this morning:
Swap: 136M available   93M used   43M free  173M cached
(Only 136M available for swap? and 173M cached??)

but now the top reported something different:
Swap:136M available    97M used  39M free  56M cached

Okay, now I understand that part of your previous comment.

I'm not really familar with yast. I thought it was just a tool for installing SuSE. Are you sure that it can re-size partitions on an existing system? There's more to that than just changing the size as the basic structure of a file system has to be adjusted to take into account the new partition size.
I didn't use yast to resize the partition. I used the partition magic to resize it, acctually I moved a free space to the existing swap (The existing swap was 136M) and merged them together to form a larger free space. But this free space is not a swap partition any more. So I had to use yast to change this free space back to a swap partition.

The problem is that the yast reported the enlarged swap partition while it was not recognized by "top".

What I also don't understand is why my memory was so occupied.
I have 256M Memory and I started only netscape and a console to run top. The programm top report like this:

Mem: 256M available, 250M used ?? 5M free  3M Buff
Swap: 136M available, 97M used  39M free    6M cached  

size    cpu%    %mem    command
4544     0.1    1.5       kdeinit
16016     0.1    5.6       X
912       0.1    0.3       top
(sometimes)
138M       1.3      30%      Netscape  
(why can netscape occupy so many memories??)
Okay, I understand.

So it does sound like the swap partition is larger now. Have you used the procedure above to re-make swap so that it will occupy the entire partition?

yes, I used yast to let the swap to occupy the entire partition. But again, another tool called top seemed not to recognize the whole swap partition. Only 136M was reported, see above...
Okay, I believe that yast only set the partition type and didn't re-make swap. You need to boot into single user mode and execute:

# swapoff -a
# mkswap /dev/hdb2
# swapon -s

Then top should report a larger size.
Sorry, how could I boot into single user? You know I'm not quite familier with linux :-)
ASKER CERTIFIED SOLUTION
Avatar of jlevie
jlevie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi jlevie

sorry for being late. I tried your suggestion. It works! thanks a lot

Visu
thanks for the help