Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
i initially wanted to increase the size of my swap partition by doing:
dd if=/dev/zero of=/swapfile1 bs=1024 count=xxxxx
by mistake i've allocated too much of swap space (and got the message that there was no free space left on the device).
then without executing {mkswap /swapfile1 and swapon /swapfile1}
i've deleted that same swap partition (/swapfile1) by
swapoff /swapfile1
rm /swapfile1
as a result i've been left with my main partition /dev/hda5 FULL
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda5 73142560 73076172 0 100% /
i.e my swap mess has partitioned the rest of my hda5 device.
Is there a way of freeing that space without damaging the files that are already on hda5 ?
I've rebooted the computer but the memory that has been allocated has not been freed at the reboot - all my files previously on /dev/hda5 are still fine ...
What distribution / version of linux are you running?
Try booting from a rescue or live CD and run fsck on hda5.
BTW you were trying to create a swap file not a partition. You only filled the partition up, you didn't change the partitioning of hda5. Were you logged in as root when you messed everything up? Was swapfile1 actually deleted?
Originally posted by michaelk What distribution / version of linux are you running?
Try booting from a rescue or live CD and run fsck on hda5.
BTW you were trying to create a swap file not a partition. You only filled the partition up, you didn't change the partitioning of hda5. Were you logged in as root when you messed everything up? Was swapfile1 actually deleted?
Hi,
I'm running a RH8 distro Linux 2.4.18-14 i686 i686 i386 GNU/Linux.
Yes you are right i was trying to create a swap file not a partition.
I was logged as root unfortunately.
The only swap partition that remains is the old one, the new one (i.e the file) that i've created has been deleted by a rm command (i did however executed swapoff /swapfile1 before that) the cat on /proc/swaps gives me
[root] cat /proc/swaps
Filename Type Size Used Priority
/dev/hda6 partition 1044184 0 -1
[root] mount
/dev/hda5 on / type ext3 (rw)
/dev/hda3 on /boot type ext3 (rw)
i will try to check /dev/hda5 from the boot floppy using fsck any additional tips are very welcome
thanks - how about creating a swap file with 6GB (i know that this is really huge) for example in my Linux book it is written that swap files can only go up to 2GB ? Thus i will have to create three swap files each with 2GB size ? Do you know if three separate swap files are recognized as one when running a hypothetical program that uses that much memory ?
cheers
Vania
I recommend that swapping should be done to partitions, or even dedicated drives, and that those should be scattered across the various I/O channels and devices. If you have advanced bus-architectures such as SCSI or FireWire, which are capable of physically-simultaneous I/O operations, those are great to use for swap. You certainly want to pay attention to all opportunities for parallelism: for example, on a single IDE-chain the master and the slave cannot (afaik) be simultaneously active, but perhaps you have two such chains on your motherboard (or a bus-installed driver card, of course).
The rule of thumb is that your swap space should be twice the size of your RAM.
The 2x rule of thumb is IMO outdated. It depends on what applications you run and how you use the computer. Someone that only uses a email, web browsing and basic office stuff with >512mb of memory might never use swap. Multiple swaps are recognized as one. With a 2.4 kernel you can have 32 partitions ( or files) * 2GB ea. Swap files are slower then swap partitions but can be used in a flash if additional space is required.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.