Ubuntu中Swap分区挂载

 
 

Q:在Ubuntu系统安装成功之后,当Swap分区丢失或者修改大小之后,如何再挂载以及如何开机自动挂载Swap分区?

A:手动挂载Swap分区使用commandswapon eg: ~$ sudo swapon /dev/sda5

NAME

swapon, swapoff - enable/disable devices and files for paging and swap‐

ping

SYNOPSIS

Get info:

swapon -s [-h] [-V]

Enable/disable:

swapon [-f] [-p priority] [-v] specialfile...

swapoff [-v] specialfile...

Enable/disable all:

swapon -a [-e] [-f] [-v]

swapoff -a [-v]

More information: man swapon

开机自动挂载:把Swap分区的UUID放到/etc/fstab文件中

# /etc/fstab: static file system information.

#

# Use 'blkid -o value -s UUID' 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/sda7 during installation

UUID=92182c1f-033f-4c75-a727-00294285a8d9 / ext4 errors=remount-ro 0 1

# /boot was on /dev/sda6 during installation

UUID=aed858e1-2a3f-4b4a-b13c-656e1b24554b /boot ext4 defaults 0 2

# /home was on /dev/sda8 during installation

UUID=0a63aa06-8adb-47ea-9116-ed2ea0e28a5c /home ext4 defaults 0 2

# swap was on /dev/sda5 during installation

UUID=3ba1745f-1726-484f-a557-761a72073c04 none swap sw 0 0

查看UUIDls -l /dev/disk/by-uuid

zhujia@Zhujia:~$ ls -l /dev/disk/by-uuid/

total 0

lrwxrwxrwx 1 root root 11 2010-12-27 10:56 05f1c0af-2049-487a-bb45-77d0fc97c4bd -> http://www.cnblogs.com/sda10

lrwxrwxrwx 1 root root 10 2010-12-27 10:56 0a63aa06-8adb-47ea-9116-ed2ea0e28a5c -> http://www.cnblogs.com/sda8

lrwxrwxrwx 1 root root 11 2010-12-27 10:56 1cb39900-56e0-49cd-b6ca-0380bbd68d3c -> http://www.cnblogs.com/sda11

lrwxrwxrwx 1 root root 10 2010-12-27 10:56 3ba1745f-1726-484f-a557-761a72073c04 -> http://www.cnblogs.com/sda5

lrwxrwxrwx 1 root root 10 2010-12-27 10:56 92182c1f-033f-4c75-a727-00294285a8d9 -> http://www.cnblogs.com/sda7

lrwxrwxrwx 1 root root 10 2010-12-27 10:56 aed858e1-2a3f-4b4a-b13c-656e1b24554b -> http://www.cnblogs.com/sda6

lrwxrwxrwx 1 root root 10 2010-12-27 10:56 d9776b02-466b-4e20-8559-c34d1413df87 -> http://www.cnblogs.com/sda9

 
posted @ 2010-12-27 14:35  MagicLetters  阅读(1007)  评论(0编辑  收藏  举报