如何调整swap分区大小呢?
Tofloor
poster avatar
ccnyou
deepin
2013-03-23 09:45
Author
现在是使用全盘安装的 linux deepin 12.12 alpha ,在分区的时候按错创建了一个10G的swap分区,而我的物理内存只有1G,那个10G的swap分区浪费了,况且我硬盘本来就不大,我本来只想创建1G的。有什么办法改回来呢?
Reply Favorite View the author
All Replies
cxbii
deepin
2013-03-23 16:59
#1
你应该是新手吧,这样我推荐你重新安装。。。
因为如果要去调整,需要的时间。。可能重装还快些。
Reply View the author
electricface
deepin
2013-03-23 17:51
#2
用分区工具gparted先将SWAP 分区缩小,然后再配置它在系统启动时自动挂载.

手动挂载Swap分区,在终端使用命令swapon,比如[color=#FF4080:28zzivfv] sudo swapon /dev/sda5[/color:28zzivfv]   其中sda5是你在gparted界面里看到的分区编号,修改成你需要的.
要想开机自动挂载:把Swap分区的UUID放到/etc/fstab文件中  uuid是一长串的字母数字序列,用来辨识每个分区吧.查看UUID的命令:[color=#FF40FF:28zzivfv]ls -l /dev/disk/by-uuid[/color:28zzivfv]
编辑这个文件的命令
[color=#FF4080:28zzivfv]sudo gedit /etc/fstab[/color:28zzivfv]
  1. # /etc/fstab: static file system information.
  2. #
  3. # Use 'blkid -o value -s UUID' to print the universally unique identifier
  4. # for a device; this may be used with UUID= as a more robust way to name
  5. # devices that works even if disks are added and removed. See fstab(5).
  6. #
  7. #
  8. proc /proc proc nodev,noexec,nosuid 0 0
  9. # / was on /dev/sda7 during installation
  10. UUID=92182c1f-033f-4c75-a727-00294285a8d9 / ext4 errors=remount-ro 0 1
  11. # /boot was on /dev/sda6 during installation
  12. UUID=aed858e1-2a3f-4b4a-b13c-656e1b24554b /boot ext4 defaults 0 2
  13. # /home was on /dev/sda8 during installation
  14. UUID=0a63aa06-8adb-47ea-9116-ed2ea0e28a5c /home ext4 defaults 0 2
  15. # swap was on /dev/sda5 during installation
  16. UUID=3ba1745f-1726-484f-a557-761a72073c04 none swap sw 0 0
Copy the Code
记得在这个文件的末尾加上这么一句
UUID=[color=#FF4040:28zzivfv]3ba1745f-1726-484f-a557-761a72073c04[/color:28zzivfv] none swap sw 0 0
如果你发现这个文件原来就有 none swap sw 0 0 ,你只需要修改uuid= 后面的这串字母数字序列成你看到的序列吧.

有些复杂,因为gparted不能帮你全部搞定.
Reply View the author
ccnyou
deepin
2013-03-24 20:09
#3
用分区工具gparted先将SWAP 分区缩小,然后再配置它在系统启动时自动挂载.

手动挂载Swap分区,在终端使用命令swapon,比如[color=#FF4080:3pdap2nv] sudo swapon /dev/sda5[/color:3pdap2nv]   其中sda5是你在gparted界面里看到的分区编号,修改成你需要的.
要想开机自动挂载:把Swap分区的UUID放到/etc/fstab文件中  uuid是一长串的字母数字序列,用来辨识每个分区吧.查看UUID的命令:[color=#FF40FF:3pdap2nv]ls -l /dev/disk/by-uuid[/color:3pdap2nv]
编辑这个文件的命令
[color=#FF4080:3pdap2nv]sudo gedit /etc/fstab[/color:3pdap2nv]
  1. # /etc/fstab: static file system information.
  2. #
  3. # Use 'blkid -o value -s UUID' to print the universally unique identifier
  4. # for a device; this may be used with UUID= as a more robust way to name
  5. # devices that works even if disks are added and removed. See fstab(5).
  6. #
  7. #
  8. proc /proc proc nodev,noexec,nosuid 0 0
  9. # / was on /dev/sda7 during installation
  10. UUID=92182c1f-033f-4c75-a727-00294285a8d9 / ext4 errors=remount-ro 0 1
  11. # /boot was on /dev/sda6 during installation
  12. UUID=aed858e1-2a3f-4b4a-b13c-656e1b24554b /boot ext4 defaults 0 2
  13. # /home was on /dev/sda8 during installation
  14. UUID=0a63aa06-8adb-47ea-9116-ed2ea0e28a5c /home ext4 defaults 0 2
  15. # swap was on /dev/sda5 during installation
  16. UUID=3ba1745f-1726-484f-a557-761a72073c04 none swap sw 0 0
Copy the Code
记得在这个文件的末尾加上这么一句
UUID=[color=#FF4040:3pdap2nv]3ba1745f-1726-484f-a557-761a72073c04[/color:3pdap2nv] none swap sw 0 0
如果你发现这个文件原来就有 none swap sw 0 0 ,你只需要修改uuid= 后面的这串字母数字序列成你看到的序列吧.

有些复杂,因为gparted不能帮你全部搞定.

恩恩,好的,谢谢
Reply View the author