Click to See Complete Forum and Search --> : Swap partition problem


lm72
06-30-2001, 05:06 PM
I am posting this on a friends behalf.

Hi All,

I have RH7.1 When the box starts up, it faiiled with swap partition on /dev/hda7
I ran fsck but not work. I cann't run linux without swap partition.(most of time, I use X windows).

Should I format the hard drive and install all over again?

Please let me know if there is a way to recover my swap partition.

Thank you for reading.

[ 30 June 2001: Message edited by: lm72 ]

twofoolish2b
06-30-2001, 07:56 PM
There's no need to format and start over, just make a swap file. Try this:

This makes a swap file of 128MB in directory /opt.

cd /opt
dd if=/dev/zero of=swapfile bs=1024 count=132207
chmod 600 swapfile
mkswap swapfile
swapon swapfile
edit /etc/fstab and add this line
/opt/swapfile swap swap defaults 0 0

lm72
06-30-2001, 08:11 PM
Thanks,

I tell him to try.

Thanks again!

Alex

lsibn
06-30-2001, 10:15 PM
That seems needlessly complex. When i use dd, I use bs=#M.

For example:
dd if=/dev/zero of=/opt/swapfile bs=1M count=128

will make a 128 MB file suitable for swap. If you use #M then you can really do it any way you like (for example, bs=64M count=2 or bs=128M count=1).