LVM 加密安装上的 SWAP 分区未安装

LVM 加密安装上的 SWAP 分区未安装

我安装了 Ubuntu 14.04 并选中了 LVM 加密分区选项,让安装程序按照默认行为完成其工​​作。当我启动时,在输入密码后,启动画面中出现一条投诉,称无法安装 SWAP 分区,并告诉我要等待,按 S 忽略或按 M 手动安装。

以下是我收集到的所有相关信息:

vmatir@vmatir-X200MA:~$ sudo swapon -a
swapon: /dev/mapper/ubuntu--vg-swap_1: la lectura de la cabecera de intercambio falló: Argumento inválido
swapon: /dev/mapper/cryptswap1: stat falló: No existe el archivo o el directorio
vmatir@vmatir-X200MA:~$

/////////////////////////////////////
The first line says: the reading of the swap header failed: invalid argument
The second line says: stat failed: the file or directory doesn't exist
////////////////////////////////////

vmatir@vmatir-X200MA:~$ lsblk
NAME                           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                              8:0    0 465,8G  0 disk  
├─sda1                           8:1    0   512M  0 part  /boot/efi
├─sda2                           8:2    0   244M  0 part  /boot
└─sda3                           8:3    0   465G  0 part  
  └─sda3_crypt (dm-0)          252:0    0   465G  0 crypt 
    ├─ubuntu--vg-root (dm-1)   252:1    0 463,1G  0 lvm   /
    └─ubuntu--vg-swap_1 (dm-2) 252:2    0   1,9G  0 lvm   
vmatir@vmatir-X200MA:~$ 

// swap_1 not mounting.

vmatir@vmatir-X200MA:~$ free -m
             total       usado       libre     compart.    búffers     almac.
Mem:          1888       1814         73        302         56        885
-/+ buffers/cache:        872       1015
Intercambio:          0          0          0
vmatir@vmatir-X200MA:~$ 

vmatir@vmatir-X200MA:~$ mountall -v
/ es local
/proc es virtual
/proc/sys/fs/binfmt_misc es virtual
/sys es virtual
/sys/fs/cgroup es virtual
/sys/fs/fuse/connections es virtual
/sys/kernel/debug es virtual
/sys/kernel/security es virtual
/sys/firmware/efi/efivars es virtual
/dev es virtual
/dev/pts es virtual
/tmp es local
/run es virtual
/run/lock es virtual
/run/shm es virtual
/run/user es virtual
/sys/fs/pstore es virtual
/boot es local
/boot/efi es local
/dev/mapper/ubuntu--vg-swap_1 es swap
/dev/mapper/cryptswap1 es swap
/sys/fs/cgroup/systemd es virtual
/home/vmatir es virtual
/run/user/1000/gvfs es local
mountall: No es posible escuchar conecciones privadas: Failed to bind socket "/com/ubuntu/mountall/server/": La dirección ya se está usando
mounting event sent for /tmp
mountall: Desconectado de Upstart
vmatir@vmatir-X200MA:~$ 

vmatir@vmatir-X200MA:~$ cat /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>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda2 during installation
UUID=264a8a19-71da-4f00-b3f9-f90bd565b531 /boot           ext2    defaults        0       2
# /boot/efi was on /dev/sda1 during installation
UUID=D764-71B4  /boot/efi       vfat    defaults        0       1
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0
vmatir@vmatir-X200MA:~$ 

我确实需要安装这个 SWAP 分区,因为这台笔记本电脑只有 1.8GB 的​​ RAM,而且如果电脑不完全冻结,我几乎看不到我的邮件。

答案1

感谢@Palantir,修复正在运行:sudo mkswap /dev/mapper/ubuntu--vg-swap_1

并注释掉最后一行或者删除/etc/fstab的最后一行:

vmatir@vmatir-X200MA:~$ cat /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>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda2 during installation
UUID=264a8a19-71da-4f00-b3f9-f90bd565b531 /boot           ext2    defaults        0       2
# /boot/efi was on /dev/sda1 during installation
UUID=D764-71B4  /boot/efi       vfat    defaults        0       1
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
vmatir@vmatir-X200MA:~$ 

现在交换分区在启动时挂载:

vmatir@vmatir-X200MA:~$ free -m
             total       usado       libre     compart.    búffers     almac.
Mem:          1888       1619        268        201         57        781
-/+ buffers/cache:        780       1107
Intercambio:       1931          0       1931
vmatir@vmatir-X200MA:~$ lsblk
NAME                           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                              8:0    0 465,8G  0 disk  
├─sda1                           8:1    0   512M  0 part  /boot/efi
├─sda2                           8:2    0   244M  0 part  /boot
└─sda3                           8:3    0   465G  0 part  
  └─sda3_crypt (dm-0)          252:0    0   465G  0 crypt 
    ├─ubuntu--vg-root (dm-1)   252:1    0 463,1G  0 lvm   /
    └─ubuntu--vg-swap_1 (dm-2) 252:2    0   1,9G  0 lvm   [SWAP]
vmatir@vmatir-X200MA:~$

相关内容