Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dcore:swap_partition_or_file [2016/08/09 02:01] – [Swap Partition Install] nitramdcore:swap_partition_or_file [2017/09/17 09:20] (current) – internal links corrected sm8ps
Line 1: Line 1:
-===== dCore Swap Partition or Swap File =====+===== dCore Swap =====
  
-==== Swap Overview ====+==== Overview ====
  
-A swap primer for dCore users with minimal Linux or no Tiny Core Linux experience. Depending on intended use, a [[https://www.linux.com/news/all-about-linux-swap-space|Linux swap partition or swap file]] is recommended for systems with < 1-2 GB RAM. Swap is especially useful on low RAM systems when importing/updating large extensions or running heavier applications.+A swap primer for dCore users with minimal Linux or Tiny Core Linux experience.
  
-By default, dCore will seek and utilize any existing swap partition at boot. To confirm whether a swap partition is being utilized, run ''cat /etc/fstab'', ''free -m'' and/or ''cat /proc/swaps'', examples:+Depending on intended use, a [[https://www.linux.com/news/all-about-linux-swap-space|Linux swap partition or swap file]] is recommended for systems with < 1-2 GB RAM. Swap is especially useful on low RAM systems to import/update large extensions, run numerous/heavier applications, compile software or set up hibernation. 
 + 
 +By default, dCore will seek and utilize any existing swap partition at boot. It also by default utilizes [[https://en.wikipedia.org/wiki/Zswap|zswap]] at boot. A boot code is necessary to enable previously set up swap file. Review the swap related [[dCore:swap_partition_or_file#boot_codes|boot codes]] below for more information related to enabling a swap file or disabling swap and zswap. 
 + 
 +The following commands are useful to confirm swap utilization: 
 +  cat /etc/fstab 
 +  cat /proc/swaps 
 +  dmesg | grep swap 
 +  free -m 
 + 
 +Example outputs outlined below utilizing a system with 512 MB RAM729 MB swap partition plus zswap. Note total swap indicated by ''free -m'' includes all available swap (eg. swap partition + zswap).
 <code> <code>
 tc@box:~$ cat /etc/fstab | grep swap tc@box:~$ cat /etc/fstab | grep swap
-/dev/sda5       none            swap     defaults             0 0 # Added by TC+/dev/zram0      swap            swap     defaults,noauto      0 0 
 +/dev/sda5       none            swap     defaults             0 0
 </code> </code>
 <code> <code>
-tc@box:~$ free -m +tc@box:~$ cat /proc/swaps  
-             total       used       free     shared    buffers     cached +Filename                                Type            Size    Used    Priority 
-Mem:           500        484         15         73         37        267 +/dev/zram0                              partition       116524  5224    -1 
--/+ buffers/cache:        179        320 +/dev/sda5                               partition       746984  0       -2
-Swap:          729                 727+
 </code> </code>
 <code> <code>
-tc@box:~$ cat /proc/swaps +tc@box:~$ dmesg | grep swap 
-Filename                                Type            Size    Used    Priority +   2.968436] Adding 116524k swap on /dev/zram0.  Priority:-1 extents:1 across:116524k SSFS 
-/dev/sda5                               partition       746984  0       -1+[   10.644207] Adding 746984k swap on /dev/sda5 Priority:-2 extents:across:746984k FS
 </code> </code>
 +<code>
 +tc@box:~$ free -m
 +             total       used       free     shared    buffers     cached
 +Mem:           500        484         15         80         62        233
 +-/+ buffers/cache:        188        311
 +Swap:          843          5        838
 +</code>
 +
 +==== Swap Partition ====
 +Setting up a swap partition during a fresh installation using [[http://tldp.org/HOWTO/Partition/fdisk_partitioning.html|fdisk]] is outlined in the [[dCore:installation_from_iso_without_boot_loader#partition_hard_drive|Partition Hard Drive]] and [[dCore:installation_from_iso_without_boot_loader#create_hard_drive_file_systems|Create Hard Drive File Systems]] sections of [[dCore:installation_from_ISO_without_boot_loader|dCore Install from ISO to Hard Drive Without Pre-Existing Boot Loader]]. For systems with a pre-partitioned drive, it may be easier to use a [[https://livecdlist.com/|Linux LiveCD]] that contains [[http://gparted.org/|GParted]]. Alternatively set up a swap file, outlined below. To confirm the swap partition is being used, reboot system and run the commands outlined above.
 +
 +==== Swap File ====
 +If a swap partition was not set up prior to the installation of dCore, it would be easiest to set up a swap file rather than create a new swap partition. From a graphic environment open Control Panel (cpanel) -> Swapfile Tool (swapfile) and enter the desired mounted partition to utilize along with the desired swap file size. Then add the [[http://tinycorelinux.net/faq.html#bootcodes|swapfile bootcode]] to the system's boot loader to activate upon reboot, example ''swapfile=sda1''. To confirm the swap file is being used, reboot system and run the commands outlined above.
 +
 +==== Boot Codes ====
 +For more information regarding Tiny Core Linux boot codes review [[wiki:boot_codes_explained|boot codes explained]].
  
-==== Swap Partition Install ==== +The following swap related [[http://distro.ibiblio.org/tinycorelinux/faq.html#bootcodes|boot codes]] are available: 
-Setting up a hard drive swap partition during a fresh installation using [[http://tldp.org/HOWTO/Partition/fdisk_partitioning.html|fdisk]] is outlined in the [[http://wiki.tinycorelinux.net/dcore:installation_from_iso_without_boot_loader#partition_hard_drive|Partition Hard Drive]] and [[http://wiki.tinycorelinux.net/dcore:installation_from_iso_without_boot_loader#create_hard_drive_file_systems|Create Hard Drive File Systems]] sections of [[dcore:installation_from_ISO_without_boot_loader|dCore Install from ISO to Hard Drive Without Pre-Existing Boot Loader]]Systems with a pre-partitioned drive may find it easiest to use a [[https://livecdlist.com/|Linux LiveCD]] that contains [[http://gparted.org/|GParted]] to re-partition a drive and create a swap partition. Alternatively set up a swap file, outlined below.+  *swapfileuse the specified partition's swap file (egswapfile=sda2). 
 +  *noswapdisable use of any swap partition(s) (egnoswap). 
 +  *nozswapdisable zswap (egnozswap).
  
-==== Swap Partition Disable ==== +==== Miscellaneous ==== 
-The noswap boot code can be used to disable the use of a swap partition at boot. +As outlined, dCore automatically seeks available swap partition(s) at boot. If using the swapfile boot code, swapfile needs to be set up in advanceBy default dCore uses zswap, which sets aside block of RAM to use as compressed swap space, so systems with adequate RAM may not require dedicated swap. Review the Wikipedia zswap link above for more information, especially the [[https://en.wikipedia.org/wiki/CPU|CPU]] cycles vs [[https://en.wikipedia.org/wiki/I/O|I/O]] tradeoff. Actual system experimentation is recommended to determine which swap options or boot codes are requiredif anyThis [[http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/|Linux Swap File How To]] is a valuable resource for manually creating a swap file or experimenting with swappiness.
-http://forum.tinycorelinux.net/index.php?topic=19421.0 +
-==== Swap File Install ==== +
-If a swap partition was not set up prior to the installation of dCore, it may be easiest to simply set up a swap fileFrom graphic environment open Control Panel (cpanel) -> Swapfile Tool (swapfile) and enter the desired mounted partition to utilize along with the desired swap file sizeThen add the [[http://tinycorelinux.net/faq.html#bootcodes|swapfile bootcode]] to the systems existing boot loader to activate upon rebootexample ''swapfile=sda1''. To confirm the swap file is being used, upon reboot run ''cat /proc/swaps''.+
  
-**[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore Wiki Welcome page]]**+**[[dCore:welcome|> Return to the dCore Wiki Welcome page]]**
  
Print/export
QR Code
QR Code dcore:swap_partition_or_file (generated for current page)