LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 11-30-2005, 06:17 PM   #1
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Rep: Reputation: 0
Made a mess with my swap partitions


Hi all,

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 ...

any idea thanks.
 
Old 11-30-2005, 07:48 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
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?
 
Old 11-30-2005, 11:12 PM   #3
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
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
 
Old 12-01-2005, 10:17 AM   #4
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Original Poster
Rep: Reputation: 0
I have one question can i boot with GRUB in a single user mode and then run fsck on my /dev/hda5 ?
thanks.
i.e
 
Old 12-01-2005, 10:23 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
If you have the RH8 install cd you should be able to boot into the rescue mode and run fsck.
 
Old 12-01-2005, 10:57 AM   #6
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Original Poster
Rep: Reputation: 0
Hi thanks,

i've managed to run fsck from GRUB in a single user mode this is what i did at the prompt after booting with GRUB using " single"

umount /dev/hda5
fsck -t ext3 /dev/hda5

and got ...

fsck 1.27 (8-Mar-2002)
e2fsck 1.27 (8-Mar-2002)
/: clean, 229301/9289728 files, 18562727/18577156 blocks

my /dev/hda5 is still 100% full ... any idea would be most welcome !
 
Old 12-01-2005, 11:08 AM   #7
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Original Poster
Rep: Reputation: 0
Actually i've just found swap files that i've created !
[roo]]# ll -h /swapfile*
-rw-r--r-- 1 root root 2.0G Nov 10 12:26 /swapfile
-rw-r--r-- 1 root root 33G Nov 30 19:04 /swapfile1
-rw-r--r-- 1 root root 2.0G Nov 16 21:11 /swapfile2

how should i delete them should i first do:

[root]swapoff /swapfile
then use rm after swapoff ?
i.e
[root] rm /swapfile ?

thanks again.

MORE ...

if i do

[root]cat /proc/swaps
Filename Type Size Used Priority
/dev/hda6 partition 1044184 0 -1

they do not figure as swap files should i just delete them using rm ?




Last edited by VaniaMih; 12-01-2005 at 11:12 AM.
 
Old 12-01-2005, 11:16 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Since they are not being used as swap just delete them using rm.
 
Old 12-01-2005, 11:21 AM   #9
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Original Poster
Rep: Reputation: 0
OK it worked thanks michaelk !

[root]df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda5 73142560 34247172 35179960 50% /
 
Old 12-01-2005, 12:04 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
To create a 20mb swap file example:

dd if=/dev/zero of=/usr/local/newswap bs=1000000 count=20
chmod 600 /usr/local/newswap (set permissions)
mkswap /usr/loca/newswap (create filesystem)
swapon /usr/local/newswap (to activate it)

/usr/local/swapfile swap swap defaults 0 0 ( add to /etc/fstab to activate it at boot)

Change the location as desired.
 
Old 12-01-2005, 12:42 PM   #11
VaniaMih
LQ Newbie
 
Registered: Nov 2005
Location: canada
Distribution: RH8
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 12-01-2005, 12:47 PM   #12
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
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.
 
Old 12-01-2005, 01:23 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
External drive now internal - Mandrake made it a swap joeaverage Mandriva 2 11-14-2005 01:03 AM
Icons->Align to grid. Made a mess Lier Linux - Software 1 02-23-2005 05:01 PM
I made a ddclient mess =( ericnmu Linux - Software 2 11-08-2004 03:00 PM
How many partitions i should made dark_light Linux - General 2 05-06-2002 02:26 AM
Windows can't see mandrake-made partitions leiavoia Linux - Software 5 03-16-2002 08:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration