LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices



Reply
 
Search this Thread
Old 06-06-2006, 04:11 AM   #1
Lokathor
Member
 
Registered: Oct 2005
Location: Boise, ID
Distribution: Debian testing
Posts: 99

Rep: Reputation: 15
I forgot to make a swap partition


I setup debian testing the other day and didn't assign any space to be swap space. Luckily i do have two HDDs and one of them is holding most of my stuff that would otherwise be in /home.

Is is possible to safely modify my /home partition (ext3) in place to make room to create a swap partition (and how would I do so if it is)? Or should I just move everything in /home to another location, erase and recreate the partition at a new smaller size, and then make the swap space?
 
Old 06-06-2006, 04:48 AM   #2
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
You don't need an actual partition, you can use a file for swap. Clicky here. The instructions are old but they'll work the same for modern distrobutions.
 
Old 06-06-2006, 04:50 AM   #3
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Rep: Reputation: 30
Hi lokathor,


can you pour in the outputs of
/etc/fstab
df -m
fdisk -l


If you have enough space and two drives you may move /home data to /home on partition where / is located then change proper changes in /etc/fstab and remount all or reboot to make the changes you wanted to do.

Hope this is going to help you
 
Old 06-06-2006, 04:54 AM   #4
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Rep: Reputation: 30
Hi Lokathor & cs-cam,

Physical swap is always faster than that of looped one? Won't it degrade the performance of the whole system?
This is what I have observed. If no other chance is left
then this option is great but in other cases we should try to avoid that. ie. where we can make partitions available.


Pinch me If I am wrong
 
Old 06-06-2006, 05:08 AM   #5
Lokathor
Member
 
Registered: Oct 2005
Location: Boise, ID
Distribution: Debian testing
Posts: 99

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by imagineers7
can you pour in the outputs of
/etc/fstab
df -m
fdisk -l
Code:
compy:/home/daniel# cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    noatime,errors=remount-ro 0       1
/dev/hda6       /home           ext3    noatime,nodev   0       2
/dev/hdg1       /mnt/hdg        ext3    noatime         0       2
/dev/hda5       /tmp            ext3    noatime,nodev,nosuid 0       2
/dev/hda2       /usr            ext3    noatime,nodev   0       2
/dev/hda3       /var            ext3    noatime,nodev,nosuid 0       2
/dev/hdc        /media/cdrom0   iso9660 ro,user,noauto  0       0
/dev/hdd        /media/cdrom1   iso9660 ro,user,noauto  0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
compy:/home/daniel# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/hda1                 1787       152      1540   9% /
tmpfs                      253         0       253   0% /dev/shm
/dev/hda6                18786       264     17568   2% /home
/dev/hdg1               187786     97284     80964  55% /mnt/hdg
/dev/hda5                 4695        36      4421   1% /tmp
/dev/hda2                 7513       793      6339  12% /usr
/dev/hda3                 4695       602      3855  14% /var
compy:/home/daniel# fdisk -l

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1         243     1951866   83  Linux
/dev/hda2             244        1216     7815622+  83  Linux
/dev/hda3            1217        1824     4883760   83  Linux
/dev/hda4            1825        4865    24426832+   5  Extended
/dev/hda5            1825        2432     4883728+  83  Linux
/dev/hda6            2433        4865    19543041   83  Linux

Disk /dev/hdg: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdg1               1       24321   195358401   83  Linux
cs-cam: is it "Just as good" to have a file for it? I seem to have gotten the impression from things that it's better to have an actual partition for the swap space (fore reasons that are currently beyond me).

Last edited by Lokathor; 06-06-2006 at 05:10 AM.
 
Old 06-06-2006, 06:31 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,497

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Quote:
Originally Posted by imagineers7
Pinch me If I am wrong
: pinch :

I personally always prefer partition(s), but with 2.6 the performance penalty of using a swap file is no more.
 
Old 06-06-2006, 06:33 PM   #7
mikieboy
Member
 
Registered: Apr 2004
Location: Warrington, Cheshire, UK
Distribution: Linux Mint 12 LXDE
Posts: 555

Rep: Reputation: 33
Lokathor, here is a link that might be of help

http://www.tldp.org/LDP/sag/html/swap-space.html
 
Old 06-07-2006, 03:24 AM   #8
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Rep: Reputation: 30
Post

Hi Lokathor,


You have /tmp on /hda5 . Your / on hda1 both of which have a lot of space in it.
Idea:-

1) Temporarily change /etc/fstab to reflect

Quote:
#/dev/hda5 /tmp ext3 noatime,nodev,nosuid 0 2
So that the next time machine gets rebooted the hda5 gets released and your /tmp directory is on / ie. on hda1. And you will not get the resource busy error.
Reboot the machine.

2) fdisk /dev/hda
delete partition 5 which is very safe to do as it is temp partition.
create partition for /tmp & keep some space for swap partition
then create a partition for swap all the remaining proccess goes as usual.

3) Change /etc/fstab as per new partition table.

Reboot the machine with swap enabled!

Hope this will help you.

Last edited by imagineers7; 06-07-2006 at 03:28 AM.
 
Old 06-07-2006, 03:46 AM   #9
KRiSX.cjb.net
Member
 
Registered: Jul 2004
Distribution: Debian
Posts: 40

Rep: Reputation: 15
i made a swap partition... but i dont think its enabled... does it matter?
 
Old 06-07-2006, 04:00 AM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,497

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Only if you want to use it.
Try "swapon -s" from a terminal session.
 
Old 06-07-2006, 04:10 AM   #11
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Add an entry in /etc/fstab for you new swap partition.
/dev/hda6 swap swap defaults 0 0

I don't know which device it is on your system.
 
Old 06-09-2006, 06:59 AM   #12
Lokathor
Member
 
Registered: Oct 2005
Location: Boise, ID
Distribution: Debian testing
Posts: 99

Original Poster
Rep: Reputation: 15
Thanks all, a bit of a bump when i restarted at first (forgot to format the new partitions properly for a moment), but it turned out great.
 
Old 06-10-2006, 12:34 AM   #13
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Rep: Reputation: 30
Hi Lokathor,
Thanks,
For you told us that you are out of trouble now. Many people don't reply about what happened next.

Keep it up and Pay it Forward!


Happy Linuxing
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I installed linux and forgot to create a swap space partition Starch Linux - Newbie 5 06-22-2005 09:29 AM
forgot to make partition bootable nadroj Linux - Newbie 11 04-20-2005 11:17 PM
How to make a swap partition with mac-fdisk? PsychoSync Linux - Software 1 04-03-2005 07:58 PM
forgot swap tiki Slackware 4 10-20-2004 09:49 PM
What size should I make my swap partition? bobotoes Linux - Newbie 7 09-30-2004 11:36 PM


All times are GMT -5. The time now is 02:59 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration