![]() ![]() To enable it at boot time, edit /etc/fstab (static information about the file system) to include the following where the fields are fs_spec, fs_file, fs_vfstype, fs_mntops, fs_freq and fs_passno, about which you can read by man 5 fstab: $ vi /etc/fstab Verify it is enabled by viewing the output of the command cat /proc/swaps, use free command, or $ swapon -s I recommend you read its manual page, or read this guide on Tecmint website. You can also improve your file security by changing your file attributes using chattr. $ dd if=/dev/zero of=/swapfile bs=20480 count=1MĬhange permission and create/activate swap $ chmod 600 /swapfile To preallocate space to /swapfile, you can use the line below: $ fallocate -l 20G /swapfile To displays the amount of your free and used physical and swap memory: $ free -h To display swap usage summary by your device: $ swapon -s So do not put your swap to outer tracks on SSDs but use defaults,discard options to trim your blocks as proposed by Linux Ubuntu 16.04 64 bit Linux Partition HOWTO for HDDs, not SSDs: 4.How to increase swap space? General discussion about increasing swap space for beginners.#/media/masi/SamiWeek/.swapfile none swap sw 0 0 mnt/.swapfile none swap defaults,discard 0 0 ![]() # If swap is on SSD, trim blocks each time at startup. Total used free shared buff/cache availableĪdd the following line in your /etc/fstab which is better than adding the thing to your runlevels ( /etc/rc.local), where I put the swapfile to the /mnt/.swapfile to maintain Linux/Unix philosophy and maintain the integrity of my system backup scripts If swapping to an SSD, use the discard option so that the blocks are trimmed on every reboot, so not sw # Swapon: /mnt/.swapfile: insecure permissions 0644, 0600 sudo chmod 600 free -m Setting up swapspace version 1, size = 20 GiB (21474832384 bytes) Use fallocate at the beginning instead dd because no need to put zeros sudo fallocate -l 20G sudo mkswap /mnt/.swapfile HD and Swap on same Partition - Current Workflow Setting up swapspace version 1, size = 8 GiB (8525967360 bytes) My unsuccessful workflow for the task when HD and Swap on the same partition, /dev/sda3 sudo swapoff dd if=/dev/zero of=/dev/sda3 bs=20480 count=1Mĭd: error writing '/dev/sda3': No space left on deviceĨ525971456 bytes (8.5 GB, 7.9 GiB) copied, 18.7633 s, 454 mkswap /dev/sda3 dev/sda3 220323840 236976127 16652288 8G Linux swapĬommand df -h gives Filesystem Size Used Avail Use% Mounted onĪllocate more disk space for Swap in /dev/sda3. Sector size (logical/physical): 512 bytes / 4096 bytes I cannot find any evidence why /mnt/.swapfile should be immutable so you do not need the change the file attributes of the swapfile sudo lsattr /mnt/.swapfileĬommand sudo fdisk -lu /dev/sda gives Disk /dev/sda: 113 GiB, 121332826112 bytes, 236978176 sectors Motivation: 8 GB RAM is too little 30 GB free space in my SSD I want to turn 20 GB to SSD swap Situation: increase swap size ( /dev/sda3) greater than Ram (8 GB) when HD 128 GB ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |