swap file
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
swap file
I have fresh install Mint 14 with 32G ram and OCZ Vertex 4 SSD(256G), 2TB HDD.
Looking to optimize my system and considering moving swap to HDD not SSD. Gathering not good idea to swapoff -a right? Just not sure how to move swap file. Guessing something like turnswap off and then add it using mkswap? I have used Linux before but I'm no expert either. Would appreciate a little hand holding here as I'm not sure what the steps are or if I am going down the wrong path. Any advice or insight appreciated, thx!
# swapoff /dev/device
Looking to optimize my system and considering moving swap to HDD not SSD. Gathering not good idea to swapoff -a right? Just not sure how to move swap file. Guessing something like turnswap off and then add it using mkswap? I have used Linux before but I'm no expert either. Would appreciate a little hand holding here as I'm not sure what the steps are or if I am going down the wrong path. Any advice or insight appreciated, thx!
# swapoff /dev/device
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: swap file
First check, do you use swap? With 32 GiB RAM I'd figure the only reason to have swap is so you can hibernate (suspend to disk), if you don't do that you don't need swap at all.
You can easily configure swap not to be used, by editing your /etc/fstab line and commenting out (putting a # in front of) the line for your swap. That disables swap upon reboot. You can indeed disable swap temporarily with swapoff -a. But I'm guessing you have a swap partition, and you want to reclaim the space currently used for swap on your SSD to one of your other partitions there. You can not do that while booted in to your current Linux Mint installation (you can't resize a partition you are using).
So, the steps are:
You can easily configure swap not to be used, by editing your /etc/fstab line and commenting out (putting a # in front of) the line for your swap. That disables swap upon reboot. You can indeed disable swap temporarily with swapoff -a. But I'm guessing you have a swap partition, and you want to reclaim the space currently used for swap on your SSD to one of your other partitions there. You can not do that while booted in to your current Linux Mint installation (you can't resize a partition you are using).
So, the steps are:
- Edit your /etc/fstab file and comment out the line that has swap on it. To edit this file, run the command:
The line you want to comment out (by insert a # as the first character of that line) would look similar to:
Code: Select all
gksudo gedit /etc/fstab
Code: Select all
UUID=cbfe9ae2-e86e-4d3e-89f8-db639633723a swap swap sw 0 0
- After saving that file, reboot your computer and boot from your Linux Mint installation ISO. Start GParted from there.
- Using GParted, you can delete the swap partition on your SSD. Then resize an existing partition either right before or right after the swap partition, to absorb the freed up disk space. Apply all changes and next step.
- Switch GParted to work on your second hard disk, and resize and existing partition there to make room for a swap partition if there isn't free disk space enough. Then create a new partition as type Linux swap. Apply all changes and next step.
- Reboot your computer and log in to your current Linux Mint installation.
- Run the following command, and copy the UUID value of your swap partition you just created:
Code: Select all
sudo blkid
- Edit your /etc/fstab file again, uncomment (remove the # from in front of the line) the line you commented out earlier and replace the current UUID value on that line with the one from your command. Save and close the file, then run the following command to enable swap now:
Code: Select all
sudo swapon -a
Re: swap file
I agree with xenopeek. You won't need swap with 32GB of RAM. I never suspend to disk, and I don't use more than 4GB of my 6GB, so I don't even have swap on my laptop SSD. If you want to suspend to disk, then make your swap on the HDD, and set the swapiness to something like 5.
Do that after you finished xenopeek's guide though.
Code: Select all
echo "vm/swappiness=5" >> /etc/sysctl.conf
- catweazel
- Level 19
- Posts: 9763
- Joined: Fri Oct 12, 2012 9:44 pm
- Location: Australian Antarctic Territory
Re: swap file
Some tips to keep your SSD alive a lot longer...Bunz_of_Steel wrote:I have fresh install Mint 14 with 32G ram and OCZ Vertex 4 SSD(256G), 2TB HDD.
Looking to optimize my system and considering moving swap to HDD not SSD.
Turn off ext4 journalling
When installing Mint, before running the installer, open a terminal and turn off journalling, and set the fs to be checked at regular intervals:
Code: Select all
$ sudo mke2fs -t ext4 -O ^has_journal /dev/sda1
$ sudo tune2fs -o journal_data_writeback /dev/sda1
$ sudo tune2fs -m 5 /dev/sda1
$ sudo tune2fs /dev/sda1 -i 7d
$ sudo tune2fs /dev/sda1 -c 15
$ sudo tune2fs -l /dev/sda1
When the install is completed, reboot and edit etc/fstab. Change the / mount point options to:
Code: Select all
data=writeback,noatime,discard
While you're editing fstab, mount tmp and logs into RAM so they get deleted on every reboot or shutdown:
Code: Select all
tmpfs /tmp tmpfs noatime,nodev,nosuid,noexec,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
Code: Select all
about:config
Code: Select all
browser.cache.disk.parent_directory
Code: Select all
/tmp
When you've added /tmp and /var/logs to fstab, don't use mount -a. You need to delete the contents of /var/log as root then reboot. If you don't do this then /var/log won't mount.
Also, see this thread http://forums.linuxmint.com/viewtopic.php?f=47&t=126397, and read the wiki at the link.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Re: swap file
Thank all for quick responses and advice is right on! I went with a new install as this install is about a day old only and nothing vital on it. Following along with TehGhodTrole and ran the commands to turn off ext4 journaling. Chose to install to / and did NOT format. Did have like two warning that I chose to ignore. Below is a copy of my fstab
cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=522567a9-0f7d-475c-b495-661dc5569599 / ext4 errors=remount-ro 0 1
I believe my next step is to change the /mount point options so I need to add line below to fstab?
/dev/sda1 / ext4 data=writeback,noatime,discard
cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=522567a9-0f7d-475c-b495-661dc5569599 / ext4 errors=remount-ro 0 1
I believe my next step is to change the /mount point options so I need to add line below to fstab?
/dev/sda1 / ext4 data=writeback,noatime,discard
- catweazel
- Level 19
- Posts: 9763
- Joined: Fri Oct 12, 2012 9:44 pm
- Location: Australian Antarctic Territory
Re: swap file
Yes, and well done, btw. Oops. Don't forget the 0 1 at the end. Your fstab line should look like this:Bunz_of_Steel wrote:I believe my next step is to change the /mount point options so I need to add line below to fstab?
/dev/sda1 / ext4 data=writeback,noatime,discard
Code: Select all
UUID=522567a9-0f7d-475c-b495-661dc5569599 / ext4 data=writeback,noatime,discard 0 1
writeback changes the data order. noatime stops the file system from date/timestamping files, and discard controls the SSDs TRIM to fill empty space in the background.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Re: swap file
Done deal-O here now. I added the tmp and logs into ram running fine and no kernal panics . Thanks for the advice all, really appreciate the expertise. To think folks pay for help like this for M$ and don't get near the accurate or timeliness Next step to start looking at the TRIM & scheduler as I think they have an affect on SSD longevity.
- catweazel
- Level 19
- Posts: 9763
- Joined: Fri Oct 12, 2012 9:44 pm
- Location: Australian Antarctic Territory
Re: swap file
You're welcome. Funny nic, btw.Bunz_of_Steel wrote:Thanks for the advice all, really appreciate the expertise.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.