Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Destroying SWAP on Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
temple.to.temple
n00b
n00b


Joined: 13 Sep 2011
Posts: 30
Location: SK

PostPosted: Fri Oct 18, 2013 8:26 am    Post subject: Destroying SWAP on Gentoo Reply with quote

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
View user's profile Send private message
schorsch_76
Guru
Guru


Joined: 19 Jun 2012
Posts: 450

PostPosted: Fri Oct 18, 2013 9:39 am    Post subject: Reply with quote

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
View user's profile Send private message
temple.to.temple
n00b
n00b


Joined: 13 Sep 2011
Posts: 30
Location: SK

PostPosted: Fri Oct 18, 2013 11:23 am    Post subject: Reply with quote

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
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 770
Location: over here

PostPosted: Fri Oct 18, 2013 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 993
Location: Quebec, Canada

PostPosted: Fri Oct 18, 2013 6:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Fri Oct 18, 2013 6:41 pm    Post subject: Reply with quote

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
Code:
swapon -a

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54028
Location: 56N 3W

PostPosted: Fri Oct 18, 2013 7:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
temple.to.temple
n00b
n00b


Joined: 13 Sep 2011
Posts: 30
Location: SK

PostPosted: Mon Oct 21, 2013 7:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum