General TC > Tiny Core Netbooks

Manually Format Swap

<< < (2/2)

cute curtis:
Hi, thanks for immediate reply, I wonder why my swap cached is 0KB am I really utilizing this?


--- Code: ---tc@box:~$ cat /proc/meminfo
MemTotal:        1021812 kB
MemFree:          916932 kB
MemAvailable:     860180 kB
Buffers:           10264 kB
Cached:            41620 kB
SwapCached:            0 kB
Active:            44140 kB
Inactive:          19484 kB
Active(anon):      25308 kB
Inactive(anon):     2592 kB
Active(file):      18832 kB
Inactive(file):    16892 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:        138056 kB
HighFree:          73844 kB
LowTotal:         883756 kB
LowFree:          843088 kB
SwapTotal:        757860 kB
SwapFree:         757860 kB
Dirty:                32 kB
Writeback:             0 kB
AnonPages:         11800 kB
Mapped:             7196 kB
Shmem:             16164 kB
Slab:              18120 kB
SReclaimable:       4608 kB
SUnreclaim:        13512 kB
KernelStack:         952 kB
PageTables:          208 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1268764 kB
Committed_AS:      32768 kB
VmallocTotal:     122880 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:              376 kB
AnonHugePages:      4096 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
DirectMap4k:       12280 kB
DirectMap4M:      888832 kB


tc@box:~$ fdisk -l
Disk /dev/sda: 149 GB, 160041885696 bytes, 312581808 sectors
19457 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id T  ype
/dev/sda1 *  63,188,62   1023,254,63    1024000  312580095  311556096  148G 83 L  inux
/dev/sda2    0,32,33     63,188,61         2048    1023999    1021952  499M 82 L  inux swap

Partition table entries are not in disk order
tc@box:~$ mkswap
BusyBox v1.29.3 (2018-12-19 15:29:37 UTC) multi-call binary.

Usage: mkswap [-L LBL] BLOCKDEV [KBYTES]

Prepare BLOCKDEV to be used as swap partition

        -L LBL  Label
tc@box:~$ lsmod
Module                  Size  Used by    Tainted: P 
ath9k                  61440  0
mac80211              237568  1 ath9k
ath9k_common           12288  1 ath9k
ath9k_hw              368640  2 ath9k,ath9k_common
ath                    24576  3 ath9k,ath9k_common,ath9k_hw
wl                   6033408  0
cpufreq_userspace      12288  0
cpufreq_conservative    12288  0
cpufreq_powersave      12288  0
cfg80211              167936  5 ath9k,mac80211,ath9k_common,ath,wl
sony_laptop            32768  0
sdhci_pci              24576  0
squashfs               28672 39
zstd_decompress        53248  1 squashfs
xxhash                 16384  1 zstd_decompress
cqhci                  16384  1 sdhci_pci
sdhci                  32768  1 sdhci_pci
mmc_core               65536  3 sdhci_pci,cqhci,sdhci
r592                   16384  0
memstick               12288  1 r592
pcspkr                 12288  0
video                  28672  1 sony_laptop
backlight              12288  2 sony_laptop,video
battery                16384  0
loop                   20480 78
ac                     12288  0
atl1c                  28672  0
lpc_ich                20480  0
acpi_cpufreq           12288  1
tc@box:~$
--- End code ---

What is the full procedure of formatting an already partitioned swap partition using mkswap and swapon

Rich:
Hi cute curtis
According to this:

--- Quote from: cute curtis on May 09, 2019, 10:46:25 PM ---
--- Code: ---tc@box:~$ fdisk -l
Disk /dev/sda: 149 GB, 160041885696 bytes, 312581808 sectors
19457 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id T  ype
/dev/sda1 *  63,188,62   1023,254,63    1024000  312580095  311556096  148G 83 L  inux
/dev/sda2    0,32,33     63,188,61         2048    1023999    1021952  499M 82 L  inux swap

Partition table entries are not in disk order
--- End code ---

--- End quote ---
You have already have a swap partition at  /dev/sda2.  When you boot, Tinycore will enable any swap devices found.

If you execute:

--- Code: ---cat /proc/swaps
--- End code ---
it will list your swap devices, their size, and how much if any of that space the system is currently using.

cute curtis:
Yes I formatted it to 500MB with G-Parted, but the swap cached is 0KB so I'm wondering if the OS is utilizing my swap partition. I would also like to know how to invoke the mkswap and swap on on command line, are these two the only command needed?

Rich:
Hi cute curtis

--- Quote from: cute curtis on May 11, 2019, 10:28:54 AM ---Yes I formatted it to 500MB with G-Parted, ...
--- End quote ---
That's what I do for swap, create a swap partition with gparted.


--- Quote --- ... but the swap cached is 0KB so I'm wondering if the OS is utilizing my swap partition. ...
--- End quote ---
The OS won't utilize any swap space until it needs to free up RAM to make room for something else. The fact that swap space
is not being used is a good thing. It means you have sufficient RAM.

Navigation

[0] Message Index

[*] Previous page

Go to full version