I have installed ubuntu in my computer, later, I format a partition as linux swap and want to replace it with existing tmp directory under mount point /. I followed procedure given in this link: http://ubuntuforums.org/showthread.php?t=1670222 . The question is that the swap is still not enabled. Here is some command output.
shijiex@shijie-ThinkPad-T410:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 28703740 5324096 21914916 20% /
tmpfs 1180916 924 1179992 1% /run
.........
/dev/sda7 28706812 17150036 10091896 63% /home
shijiex@shijie-ThinkPad-T410:~$ sudo blkid -c /dev/null -o list
device fs_type label mount point UUID
-----------------------------------------------------------------------
/dev/sda1 ext4 / 47d9205b-00a8-40e5-88d6-e8b9571799a7
...
/dev/sda7 ext4 /home e2ae897d-62b1-45d3-a17a-49e7a1b8fbe7
/dev/sda9 swap <swap> 81ce2033-4ff2-4e05-9500-aacfd1019855
shijiex@shijie-ThinkPad-T410:~$ sudo mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
......
/dev/sda8 on /opt type ext4 (rw)
/dev/sda5 on /backup type ext4 (rw)
/dev/sda6 on /other type ext4 (rw)
/dev/sda7 on /home type ext4 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/shijiex/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=shijiex)
At the end of /etc/fstab, it is:
# swap was on /dev/sda9 during installation
UUID=81ce2033-4ff2-4e05-9500-aacfd1019855 none swap sw 0 0
shijiex@shijie-ThinkPad-T410:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 28703740 5324100 21914912 20% /
udev 2942940 4 2942936 1% /dev
tmpfs 1180916 924 1179992 1% /run
none 5120 0 5120 0% /run/lock
none 2952280 156 2952124 1% /run/shm
/dev/sda8 14286320 11978284 1575672 89% /opt /dev/sda5 38317716 36097448 267144 100% /backup /dev/sda6 85532500 35151740 46029084 44% /other /dev/sda7 28706812 17150392 10091540 63% /home
The swap partition is sda9.I am not sure whether swap is enabled, because:
/dev/sda9 is not in list of df result. While previously it always should be like:
/dev/sda9 28706812 17150392 10091540 63% /tmp
Gpart shows that /dev/sda9 as linux-swap with 14.85G,
used unused -- --
I was unable to access swap area. Previously, swap was always mount as /tmp and I can access this directory. Now the /tmp is only a directory under /..
- The OS is ubuntu 12.04 lts..
[UPDATE]:
The swap should have been enabled, cat /proc/swaps
:
/dev/sda9 partition 15575036 0 -1
though the used size is 0.
Now the scenario is:
I already have tmp directory under /
, how can I mount swap this partition as mount point is /tmp. I modified last line of fstab as:
UUID=81ce2033-4ff2-4e05-9500-aacfd1019855 /tmp swap sw 0 0
Then mount -a and reboot does not report any error. But used in swap is 0 though I dumped many file content to /tmp.
So how can I fully utilized swap area, which is almost 15G? It is waste of disk if it always 0 used..
Or how can I just change /tmp
to the swap partition?
I want this because this directory is widely used in my program and it is also as exchange area between my Ubuntu and hosted WindowXP. Both requires large disk space..
None of those commands will show you if the swap is activated or not. To know whenever is the swap activated just run
swapon -s
:Another way is using
free
:almost any process/system watcher has the swap values,
htop
in this example:The swap is used only when the physical memory is not enough. Some people never gets the opportunity to use the swap while other just don't create it since they have heaps of RAM memory. I don't know why you want the swap into
/tmp
but there is not legit reasons why you would like to do this.To check the status of swqp partition you should read this link
Confirm that the swap partition exists.
https://help.ubuntu.com/community/SwapFaq#How_do_I_add_more_swap.3F