Swap file size change in Fedora latest version
hi,
I'm on Fedora 23, dell OptiPlex 745, core 2 duo, 2.13 Ghz, 1066Mhz FSB and 4 gig of RAM, the drive is a Samsung 840 EVO solid state drive. The Swap file is currently at 4 GIG. How can I change this size? i'd like to go to 8 Gig. Thanks JAmes |
Before you mess with your swap partition, run from a root terminal "swapoff /dev/sda?", with ? as your partition number. All of these partitioning commands require a root command line. You have also now received the generic forewarning about backing up your data when messing with your partitioning.
The most intuitive way to go about this would be to use Gparted and shrink a neighbhoring partition (or use unpartitioned space) so you can delete your current swap partition and create an 8 GB one. Gparted has pretty "Add" buttons and partitions can be deleted or resized by right clicking the partitions and clicking on the desired option. If you want to be savvy and do it the command line way, fire up parted with probably "parted /dev/sda" and type print to get your partition layout, then give us the output of that. If you dish out the "list" command to parted you can get a list of commands and go from there. Either way, you'll need to set the partition label of the new swap partition to "Linux swap/Solaris" and run "mkswap /dev/sda?" and "swapon /dev/sda?" |
Swap file you said? Create another file of desired size and delete the old one.
|
I possibly erranously assumed you meant swap partition rather than swap file. Making a bigger swap file would be as easy as running:
Code:
# swapoff <location of swapfile> |
Quote:
there has to be more to it? as in location? file name etc |
It really depends upon whether you did create a "swap file" or a swap partition but, anyhow, you could just read the manual. If you created a swap partition then that space is, effectively, lost until you run something like gparted (risking your data) to resize the other partitions to move into that space.
|
Keep in mind that you can have more than one swap file or partition. Depending on how your disk is partitioned, it might be easier to add a second swap partition rather than resize the existing one, or you could add a swap file to supplement the existing swap space (file or partition).
|
1 Attachment(s)
Quote:
volume: /dev/fedora_localhost/swap So do I have a swap file? partition or both? Keep in mind, I'm a very beginner in Linux. Thanks James |
Quote:
I'm not finding in the manual where to change the existing size? I may need to change the partition size first from 4.2 gig to ..oh? 8.5 gig as to have then change the swap to 8 gig. As I've said before, keep in mind I'm a Linux beginner Thanks James. |
Quote:
I think I like this idea, add another partition..say another 4.2 gig, and make a second 4 gig swap there...and it would use them both? i'm not sure as how to "point it" to both? or even how to create a second partition. Thanks James |
Why do you think you need to change it ?.
|
Quote:
|
It's very easy to mis-read (or be misled) with memory stats. Let's see the numbers that have you concerned.
Adding extra swap is no major task, and simply need to be added to /etc/fstab once verified. Let's also see the output from Code:
lsblk |
Quote:
[root@localhost ajfd]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111.8G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 111.3G 0 part ├─fedora_localhost-root 253:0 0 50G 0 lvm / ├─fedora_localhost-swap 253:1 0 3.9G 0 lvm [SWAP] └─fedora_localhost-home 253:2 0 57.4G 0 lvm /home sr0 11:0 1 1024M 0 rom |
How about this, which has been suggested. Will this work? If so What will this do with my current 4gig swap?
(open terminal, switch to root) dd if=/dev/zero of=/my8GBswap bs=1M count=8192 chmod 600 /my8GBswap mkswap /my8GBswap swapon /my8GBswap echo "/my8GBswap swap swap defaults 0 0" >> /etc/fstab verify with swapon -s |
All times are GMT -5. The time now is 12:08 PM. |