我之前发过问题其中 solsTiCe 向我展示了如何在 GPT 分区上设置交换。它工作了一段时间,但现在我又遇到了问题。交换再次未被检测到。我遵循了完全相同的建议,但这次不起作用。重启后,它出现 cryptswap 消息询问我是否要跳过安装等。登录后free
显示没有交换,sudo fdisk -l
显示以下输出:
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x055144b6
Device Boot Start End Blocks Id System
/dev/sda1 1 1953525167 976762583+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/mapper/cryptswap: 7999 MB, 7999586304 bytes
255 heads, 63 sectors/track, 972 cylinders, total 15624192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xe001aed0
Disk /dev/mapper/cryptswap doesn't contain a valid partition table
blkid
具有与上一个问题完全相同的输出,也是如此sudo gdisk /dev/sda
。
的输出/etc/fstab/
为:
# /etc/fstab: static file system information.
#
# Use 'blkid' 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>
# / was on /dev/sda8 during installation
UUID=775b2ce6-e738-40e5-828f-eccdf49cd63a / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=B639-EA4B /boot/efi vfat defaults 0 1
# /home was on /dev/sda10 during installation
UUID=22c6084f-1225-48eb-a295-5d1a0d3d8830 /home ext4 defaults 0 2
# /windows was on /dev/sda7 during installation
UUID=6D02-3AEA /windows vfat utf8,umask=007,gid=46 0 1
# swap was on /dev/sda9 during installation
#UUID=cfa1562c-1530-4bf6-85c0-babe65ae4e05 none swap sw 0 0
#/dev/mapper/cryptswap1 none swap sw 0 0
/dev/mapper/cryptswap none swap defaults 0 0
并且/etc/crypttab
是:
#cryptswap1 UUID=cfa1562c-1530-4bf6-85c0-babe65ae4e05 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
cryptswap /dev/sda9 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
答案1
找到答案这里:
更改/etc/crypttab
为包括:
cryptswap /dev/sda9 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
并/etc/fstab
包括:
cryptswap /dev/sda9 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
現在free -m
顯示:
total used free shared buffers cached
Mem: 3377 543 2834 17 57 226
-/+ buffers/cache: 260 3117
Swap: 7628 0 7628