I have one hard disk with three partions: /, /boot, and /home. I want to add a swap file on the /home partion, because it has the most available space. I found lots of pages where it gives instructions on how to add the file, but they all seem to want to put the file on /. The instructions mostly are: 1. Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536. 2. At a shell prompt as root, type the following command with count being equal to the desired block size: dd if=/dev/zero of=/swapfile bs=1024 count=65536 3. Setup the swap file with the command: mkswap /swapfile 4. To enable the swap file immediately but not automatically at boot time: swapon /swapfile 5. To enable it at boot time, edit /etc/fstab to include: /swapfile swap swap defaults 0 0 The next time the system boots, it will enable the new swap file. 6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.
But how do I tell it to make the file on the /home partion? Also, if I have 512 MB of ram, would a 1024 MB swap file be advisable? I know that the old RAM*2 theory is out, but what is in?
Thanks in advance.
Dotan Cohen http://technology-sleuth.com/question/how_can_i_be_safe_online.html
.
On Sat, 2005-10-29 at 03:03 +0200, Dotan Cohen wrote:
I have one hard disk with three partions: /, /boot, and /home. I want to add a swap file on the /home partion, because it has the most available space. I found lots of pages where it gives instructions on how to add the file, but they all seem to want to put the file on /. The instructions mostly are:
- Determine the size of the new swap file and multiple by 1024 to
determine the block size. For example, the block size of a 64 MB swap file is 65536. 2. At a shell prompt as root, type the following command with count being equal to the desired block size: dd if=/dev/zero of=/swapfile bs=1024 count=65536 3. Setup the swap file with the command: mkswap /swapfile 4. To enable the swap file immediately but not automatically at boot time: swapon /swapfile 5. To enable it at boot time, edit /etc/fstab to include: /swapfile swap swap defaults 0 0 The next time the system boots, it will enable the new swap file. 6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.
But how do I tell it to make the file on the /home partion? Also, if I have 512 MB of ram, would a 1024 MB swap file be advisable? I know that the old RAM*2 theory is out, but what is in?
----- try dd uf=/dev/zero of=/home/swapfile bs=1024 count=65536 swapon /home/swapfile
instead
Craig
On Sat, Oct 29, 2005 at 03:03:35 +0200, Dotan Cohen dotancohen@gmail.com wrote:
I have one hard disk with three partions: /, /boot, and /home. I want to add a swap file on the /home partion, because it has the most available space. I found lots of pages where it gives instructions on how to add the file, but they all seem to want to put the file on /.
There does seem to be some sort of problem with it not being on /. The swapon -a during boot doesn't seem to turn on swapfiles on other partitions even though as far as I can tell they should be mounted by that point. swapon -a after boot does pick them up. I didn't pursue this too far, so I might have missed something. For the time being I put a swap file on both / and another file system (on a second disk). The one on / gives me enough swap space for normal use and I can turn on the other one manually after reboots.
On Fri, Oct 28, 2005 at 11:03:42PM -0500, Bruno Wolff III wrote:
On Sat, Oct 29, 2005 at 03:03:35 +0200, Dotan Cohen dotancohen@gmail.com wrote:
I have one hard disk with three partions: /, /boot, and /home. I want to add a swap file on the /home partion, because it has the most available space. I found lots of pages where it gives instructions on how to add the file, but they all seem to want to put the file on /.
There does seem to be some sort of problem with it not being on /. The swapon -a during boot doesn't seem to turn on swapfiles on other partitions even though as far as I can tell they should be mounted by that point. swapon -a after boot does pick them up. I didn't pursue this too far, so I might have missed something. For the time being I put a swap file on both / and another file system (on a second disk). The one on / gives me enough swap space for normal use and I can turn on the other one manually after reboots.
swapon should work on swap files no matter what partition they are in. At it least it used to work for me on earlier Fedora versions.-
======================================================================= He was part of my dream, of course -- but then I was part of his dream too. -- Lewis Carroll ------------------------------------------- Aaron Konstam Computer Science Trinity University telephone: (210)-999-7484
On Sat, 2005-10-29 at 08:05 -0500, akonstam@trinity.edu wrote:
On Fri, Oct 28, 2005 at 11:03:42PM -0500, Bruno Wolff III wrote:
On Sat, Oct 29, 2005 at 03:03:35 +0200, Dotan Cohen dotancohen@gmail.com wrote:
I have one hard disk with three partions: /, /boot, and /home. I want to add a swap file on the /home partion, because it has the most available space. I found lots of pages where it gives instructions on how to add the file, but they all seem to want to put the file on /.
There does seem to be some sort of problem with it not being on /. The swapon -a during boot doesn't seem to turn on swapfiles on other partitions even though as far as I can tell they should be mounted by that point. swapon -a after boot does pick them up. I didn't pursue this too far, so I might have missed something. For the time being I put a swap file on both / and another file system (on a second disk). The one on / gives me enough swap space for normal use and I can turn on the other one manually after reboots.
swapon should work on swap files no matter what partition they are in. At it least it used to work for me on earlier Fedora versions.-
Swap partitions are not dependent upon mounted filesystems, but a swap file is. The one critical thing is the partition where the swap file is located MUST be mounted before swap is activated. That is why it is recommended that the swap file be in /, since / is mounted before any others and swap is enabled very early in the boot process.
If you want to place it elsewhere that is not mounted and thus not able to activate at the normal swapon point, an easy workaround may to put a line in /etc/rc.local and run swapon for that file from there.
On Sat, Oct 29, 2005 at 08:32:00 -0500, Jeff Vian jvian10@charter.net wrote:
On Sat, 2005-10-29 at 08:05 -0500, akonstam@trinity.edu wrote:
If you want to place it elsewhere that is not mounted and thus not able to activate at the normal swapon point, an easy workaround may to put a line in /etc/rc.local and run swapon for that file from there.
I did that and it still didn't work. In fact looking at the init scripts it looked like all of the file systems should be mounted when swapon -a is normally run during the boot process.
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
On Sat, Oct 29, 2005 at 08:32:00 -0500, Jeff Vian jvian10@charter.net wrote:
On Sat, 2005-10-29 at 08:05 -0500, akonstam@trinity.edu wrote:
If you want to place it elsewhere that is not mounted and thus not able to activate at the normal swapon point, an easy workaround may to put a line in /etc/rc.local and run swapon for that file from there.
I did that and it still didn't work. In fact looking at the init scripts it looked like all of the file systems should be mounted when swapon -a is normally run during the boot process.
Can I rearrange the order of the boot process? In any case there are things that I want to shut down, such as luetooth services and cups.
Dotan Cohen
http://technology-sleuth.com/technical_answer/how_can_i_be_safe_online.html
On Sat, Oct 29, 2005 at 17:21:25 +0200, Dotan Cohen dotancohen@gmail.com wrote:
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
On Sat, Oct 29, 2005 at 08:32:00 -0500, Jeff Vian jvian10@charter.net wrote:
On Sat, 2005-10-29 at 08:05 -0500, akonstam@trinity.edu wrote:
If you want to place it elsewhere that is not mounted and thus not able to activate at the normal swapon point, an easy workaround may to put a line in /etc/rc.local and run swapon for that file from there.
I did that and it still didn't work. In fact looking at the init scripts it looked like all of the file systems should be mounted when swapon -a is normally run during the boot process.
Can I rearrange the order of the boot process? In any case there are things that I want to shut down, such as luetooth services and cups.
You should at least try using swapon in rc.local to see if it works for you. There might be something odd going on in my case.
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
You should at least try using swapon in rc.local to see if it works for you. There might be something odd going on in my case.
I added the swap file and acording to cat /proc/swaps it is working. I know that this is obvious, but before I screw anything up, I just need to add the line: swapon /home/swapfile to the end of /etc/rc.local so that it will (hopefully) be started at boot? Also, should I bother adding the line: /swapfile swap swap defaults 0 0 to the end of /etc/fstab? Thanks for all your help. I really do appreciate it.
Dotan Cohen http://lyricslist.com/forum/index.php Lyrics Forum
On Sat, Oct 29, 2005 at 18:13:35 +0200, Dotan Cohen dotancohen@gmail.com wrote:
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
You should at least try using swapon in rc.local to see if it works for you. There might be something odd going on in my case.
I added the swap file and acording to cat /proc/swaps it is working. I know that this is obvious, but before I screw anything up, I just need to add the line: swapon /home/swapfile to the end of /etc/rc.local so that it will (hopefully) be started at boot? Also, should I bother adding the line: /swapfile swap swap defaults 0 0 to the end of /etc/fstab? Thanks for all your help. I really do appreciate it.
I think it is probably better to add the entry to /etc/fstab and use swapon -a so that you can just make changes to /etc/fstab and not have to muck with rc.local after every swapfile change.
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
I think it is probably better to add the entry to /etc/fstab and use swapon -a so that you can just make changes to /etc/fstab and not have to muck with rc.local after every swapfile change.
Thanks. I dont intend to change swapfiles ever again! So in that sense I will add the line to /etc/fstab, and add "swapon -a" to the end of rc.local. I just want to hear someone say "You wont break anything" before I do that.
Dotan http://technology-sleuth.com/question/what_is_a_router.html
Dotan Cohen wrote:
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
I think it is probably better to add the entry to /etc/fstab and use swapon -a so that you can just make changes to /etc/fstab and not have to muck with rc.local after every swapfile change.
Thanks. I dont intend to change swapfiles ever again! So in that sense I will add the line to /etc/fstab, and add "swapon -a" to the end of rc.local. I just want to hear someone say "You wont break anything" before I do that.
"swapon -a" uses /etc/fstab to find swap files and partitions. If you don't want to put an entry in /etc/fstab, then you have to give swapon an argument that explicitly identifies the swap file or partition.
On 10/30/05, Robert Nichols rnicholsNOSPAM@comcast.net wrote:
Dotan Cohen wrote:
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
I think it is probably better to add the entry to /etc/fstab and use swapon -a so that you can just make changes to /etc/fstab and not have to muck with rc.local after every swapfile change.
Thanks. I dont intend to change swapfiles ever again! So in that sense I will add the line to /etc/fstab, and add "swapon -a" to the end of rc.local. I just want to hear someone say "You wont break anything" before I do that.
"swapon -a" uses /etc/fstab to find swap files and partitions. If you don't want to put an entry in /etc/fstab, then you have to give swapon an argument that explicitly identifies the swap file or partition.
Bob Nichols Yes, "NOSPAM" is really part of my email address.
I have no problem modifying fstab, I just want to know that I'm not causing any damage. I'm no system admin here, and I would have no way of fixing it if I broke something and couldn't boot if I couldn't post here. So I'm double checking before I break something.
Dotan
http://technology-sleuth.com/question/how_much_memory_will_i_need_for_my_dig... How much memory will I need for my digital camera?
Dotan Cohen wrote:
On 10/30/05, Robert Nichols rnicholsNOSPAM@comcast.net wrote:
Dotan Cohen wrote:
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
I think it is probably better to add the entry to /etc/fstab and use swapon -a so that you can just make changes to /etc/fstab and not have to muck with rc.local after every swapfile change.
Thanks. I dont intend to change swapfiles ever again! So in that sense I will add the line to /etc/fstab, and add "swapon -a" to the end of rc.local. I just want to hear someone say "You wont break anything" before I do that.
"swapon -a" uses /etc/fstab to find swap files and partitions. If you don't want to put an entry in /etc/fstab, then you have to give swapon an argument that explicitly identifies the swap file or partition.
Bob Nichols Yes, "NOSPAM" is really part of my email address.
I have no problem modifying fstab, I just want to know that I'm not causing any damage. I'm no system admin here, and I would have no way of fixing it if I broke something and couldn't boot if I couldn't post here. So I'm double checking before I break something.
OK, I guess I got a bit confused reading through the whole thread. It's pretty unlikely that you will break anything. If swapon doesn't find a properly formatted swap file (you did run "mkswap" on the file, right?), it will just complain and refuse to use it.
The only real danger is running "mkswap" on a partition (e.g., "mkswap /dev/hda6") when what you wanted to do was format a swap file on the file system within that partition (e.g., "mkswap /dir/sfile"). That's a really quick way to clobber the superblock on a filesystem. (The damage is recoverable, once you've recovered from your panic attack.)
On 10/29/05, Bruno Wolff III bruno@wolff.to wrote:
On Sat, Oct 29, 2005 at 03:03:35 +0200, Dotan Cohen dotancohen@gmail.com wrote:
I have one hard disk with three partions: /, /boot, and /home. I want to add a swap file on the /home partion, because it has the most available space. I found lots of pages where it gives instructions on how to add the file, but they all seem to want to put the file on /.
There does seem to be some sort of problem with it not being on /. The swapon -a during boot doesn't seem to turn on swapfiles on other partitions even though as far as I can tell they should be mounted by that point. swapon -a after boot does pick them up. I didn't pursue this too far, so I might have missed something. For the time being I put a swap file on both / and another file system (on a second disk). The one on / gives me enough swap space for normal use and I can turn on the other one manually after reboots.
I would consider putting it on / but / is at 70% capacity- 2.3 gigs free from a total of 7.5, whereas /home is at 30%: 6.6 free from a total of 9.5 gigs. Or would I be better off putting the swap file on / despite that?
If I login as root and don't mount /home, could I partion it and put a swap partion on it? I had researched this in the past, and had come to the conclusion that on an ext3 partion this is not possible. I think that it was Alex Dalloz who talked me out of if, and I know to follow his word! But I don't think that I made it clear at the time that /home was a seperate partion. Any thoughts/opinions/experience out there?
It seems that if I put the swap file on /home then I will need to manually start it as root when I log on. Is that simply the command: "# swapon /swapfile"? Can I just add that to /etc/rc.d/rc.local and be done with it?
Dotan Cohen
technology-sleuth.com/question/why_are_internet_greeting_cards_dangerous.html