我在我的 Windows 8 Acer 台式电脑上安装了 Ubuntu 14.04 作为双启动。我确定我设置了一个交换驱动器,但现在如果我这样做,swapon -s
我似乎没有交换分区。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.
我之前在非 GPT 系统上纠正过交换问题,希望有人能帮助我在 GPT 上重新设置交换。我的系统显示以下内容:
sudo gdisk /dev/sda
然后p
显示:
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 531392B4-E90D-44D4-B066-9D0760AAE16B
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3437 sectors (1.7 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1230847 600.0 MiB 2700 Basic data partition
2 1230848 1845247 300.0 MiB EF00 EFI system partition
3 1845248 2107391 128.0 MiB 0C01 Microsoft reserved part
4 2107392 161163263 75.8 GiB 0700 Basic data partition
5 161163264 317462527 74.5 GiB 0700 Basic data partition
6 317462528 348829695 15.0 GiB 2700 Basic data partition
7 348829696 387891199 18.6 GiB 0700
8 387891200 583202815 93.1 GiB 8300
9 583202816 598827007 7.5 GiB 8200
10 598827008 1953523711 646.0 GiB 8300
我原来的交换是在上面的第 9 号。
blkid
显示:
/dev/sda1: LABEL="Recovery" UUID="C8D83761D8374D46" TYPE="ntfs"
/dev/sda2: LABEL="ESP" UUID="B639-EA4B" TYPE="vfat"
/dev/sda4: LABEL="Acer" UUID="01D0215206ACFEE0" TYPE="ntfs"
/dev/sda5: LABEL="DATA" UUID="01D0215209012810" TYPE="ntfs"
/dev/sda6: LABEL="Push Button Reset" UUID="01D021528B28B4C0" TYPE="ntfs"
/dev/sda7: UUID="6D02-3AEA" TYPE="vfat"
/dev/sda8: UUID="775b2ce6-e738-40e5-828f-eccdf49cd63a" TYPE="ext4"
/dev/sda10: UUID="22c6084f-1225-48eb-a295-5d1a0d3d8830" TYPE="ext4"
答案1
加密
要设置加密交换,将此行添加到/etc/crypttab
cryptswap /dev/sda9 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
然后添加这个/etc/fstab
/dev/mapper/cryptswap none swap defaults 0 0
您可能需要安装密码设置包裹 (sudo apt-get install cryptsetup
)。
然后重启
或不加密
运行命令:
sudo mkswap /dev/sda9
然后只需添加一行/etc/fstab
即可
/dev/sda9 none swap defaults 0 0
然后重新启动或者运行sudo swapon -a
部分用户ID
无论哪种情况,最好使用部分用户ID(因为你使用谷氨酰胺磷酸酶)而不是设备名称。使用
sudo blkid -s PARTUUID /dev/sda9
/etc/crypttab
并在或与 PARTUUID= 一起使用,/etc/fstab
而不是 /dev/sda9