[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: swap partition too small



Tony Laszlo wrote:
> 
> In trying to conserve the little hard disk space
> (110M) that I have, I have unfortunately made the
> swap partition too small when installing Debian. I
> know I should probably pay penance and do the install
> all over again, but am wondering if there is a way to
> carve out a portion of the hard disk for swap at this
> stage of the game. Something like a fips that can shrink
> a Linux partition. No? Just thought I'd ask before
> reinstalling...

You can use files for swap space as well, so if you really don't want to
repartition, you could just add more swap by using a file.

I've never actually done it before, but I'd imaging you'd want to do
something like this:

(this will give you a file 4Mb large, containing all 0's, in the root
directory)
# dd if=/dev/zero of=/swapfile bs=1k count=4096

(format it as a swap file)
# mkswap /swapfile 4096

(flush the disk cache)
# sync

(put it to use)
# swapon /swapfile

To automatically use it on boot:
Edit the /etc/fstab file and add the line:
/swapfile  swap  swap  defaults 0 0

It should work... you might have to play around with the mount options
though.

Google gave me this link (among others) with the search string "swap
file linux":
http://wip.wi-inf.uni-essen.de/doc/LDP/install-guide/node187.html

... if you want to read more on the subject.

Matthew



Reply to: