View previous topic :: View next topic |
Author |
Message |
temple.to.temple n00b
Joined: 13 Sep 2011 Posts: 30 Location: SK
|
Posted: Fri Oct 18, 2013 8:26 am Post subject: Destroying SWAP on Gentoo |
|
|
I got the question regardin SWAP in gentoo, I got swap created on /dev/sda2 , it is created as primary partition, teoreticaly if I destroy /dev/sda2 and will comment the line in /etc/fstab where /dev/sda2 swap is defined, will I boot my system without this? If I got my RAM big enough?
( to explain I need to destroy 1 partition to be able to create extended partitions, because I got 4 primary now and after that I want to create swap for gentoo on another newly created extended partiotion with: mkswap /dev/sdaX && swapon /dev/sdaX and add the line back to /etc/fstab , will this work like that? )
I will appreciate some experienced advice,
thx in advance. |
|
Back to top |
|
|
schorsch_76 Guru
Joined: 19 Jun 2012 Posts: 450
|
Posted: Fri Oct 18, 2013 9:39 am Post subject: |
|
|
This is ofcoarse possible. You dont need swap to start the system. Only if the physical ram is completly used, you get out of memory errors. Practicly i have never seen this on a linux system |
|
Back to top |
|
|
temple.to.temple n00b
Joined: 13 Sep 2011 Posts: 30 Location: SK
|
Posted: Fri Oct 18, 2013 11:23 am Post subject: |
|
|
you mean you never seen physical ram is completly used on linux system?
ok, I will do it this way.
thank you. |
|
Back to top |
|
|
mrbassie l33t
Joined: 31 May 2013 Posts: 771 Location: over here
|
Posted: Fri Oct 18, 2013 11:46 am Post subject: |
|
|
Opinion and use cases vary regarding swap, a lot of people say if you have more than 2GB then you don't need swap. I've never maxed out my 2GB on any of the distros I've used but then I'm just on a laptop with a fairly minimal setup. (I do have a swap partition ftr, swappiness=1) |
|
Back to top |
|
|
madchaz l33t
Joined: 01 Jul 2003 Posts: 993 Location: Quebec, Canada
|
Posted: Fri Oct 18, 2013 6:08 pm Post subject: |
|
|
Most desktio linux systems don't ever use swap, even if it's setup. That's the nice thing about linux. It won't put things in swap unless it really needs to. However, disk space is rather cheap these days if you're building something like a file server with virtual machines running on it. There, I've found having a few gigs of swap can make things safer and gives you a nice safety net to recover if you do something stupid like start too many VMs. On my own server, I have 10G of swap for 8G of ram. The most it as ever used is a few hundred megs, but it did keep the system from freezing on those few occasions.
Unless you're really strapped for disk space, I'd say having a few gigs of swap just means a more stable system in case you ever do run out of ram. _________________ Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
www.madchaz.com A small candle of a website. As my lab specs on it. |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Fri Oct 18, 2013 6:41 pm Post subject: |
|
|
After swapoff /dev/sda2, you don't really need to suppress /dev/sda2 to create an extended partition with, you can just change it ID that is 82 (Linux swap) for 5 (Extended) or 85 (Linux extended) and create logical partitions in like a swap.
I prefer that the number of each partition reflect it's disk space position from left to right, so my extended partition would be at the end of the disk with the number four, /dev/sda4. In practice, it's not an obligation in a DOS/MBR partitions table.
You don't need to comment the swap line in fstab but change it accordingly to the new swap partition. You have to change the number 2 for the new one, 5 or higher in the swap line of fstab. You can use a LABEL and/or a UUID. You have to reboot only if the new partitions table cannot be use immediately by Linux. It's often the case when the running host have it's root partition on the disk you are modifying.
If you don't have to reboot you can do
for the new swap be active.
I use the same amount of swap space than the Ram even if I don't need it, just to have enough space if I suspend on disk, hibernate. It can be more if I have few Ram. _________________ Paul |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54119 Location: 56N 3W
|
Posted: Fri Oct 18, 2013 7:19 pm Post subject: |
|
|
temple.to.temple,
swap is not required, its just a good idea.
You can do as you say but all the space being donated to the extended partition must be in one piece.
This means that the space where your /dev/sda2 is now will become inaccessable.
If sda1 is /boot, think about leaving swap where it is and moving the content of sda1 to your /boot directory, so that the partition table entry for sda1 can be reused for an extended partition. swap stays at sda2.
This is a little more complex as you need to reinstall grub to the MBR, update grub.conf and fstab now but in exchange, the space now occupied by sda2 is still accessable. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
temple.to.temple n00b
Joined: 13 Sep 2011 Posts: 30 Location: SK
|
Posted: Mon Oct 21, 2013 7:47 am Post subject: |
|
|
Thank you for all comments, this is my test computer, so nothing really absolutely important is running on it, I just need to create some extra partition only for storage, to place some files on it. I got 1 Gentoo and 1 Debian running on it and I need another 1 partition to create (5th). |
|
Back to top |
|
|
|