swapon --all --verbose : '读取交换头失败:参数无效'

swapon --all --verbose : '读取交换头失败:参数无效'

最近跑过启用HibernateWithEncryptedSwap并运行以下命令:swapon --all --verbose并收到:“读取交换标头失败:参数无效”

我该如何解决这个问题?以下是一些更相关的输出...

输出sudo fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes 
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors 
Units = sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00006d20 

   Device Boot      Start         End      Blocks   Id  System 
/dev/sda1   *        2048      499711      248832   83  Linux 
/dev/sda2          501758   156301311    77899777    5  Extended 
/dev/sda5          501760   156301311    77899776   8e  Linux LVM 

Disk /dev/mapper/ubuntu--t10194-root: 75.5 GB, 75539415040 bytes 
255 heads, 63 sectors/track, 9183 cylinders, total 147537920 sectors 
Units = sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk identifier: 0x00000000 

Disk /dev/mapper/ubuntu--t10194-root doesn't contain a valid partition table 

Disk /dev/mapper/ubuntu--t10194-swap_1: 4227 MB, 4227858432 bytes 
255 heads, 63 sectors/track, 514 cylinders, total 8257536 sectors 
Units = sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk identifier: 0x08040000 

Disk /dev/mapper/ubuntu--t10194-swap_1 doesn't contain a valid partition table 

Disk /dev/mapper/cryptswap1: 4225 MB, 4225761280 bytes 
255 heads, 63 sectors/track, 513 cylinders, total 8253440 sectors 
Units = sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk identifier: 0xd2236983 

Disk /dev/mapper/cryptswap1 doesn't contain a valid partition table 

感谢所有帮助!

答案1

其实修复起来很简单。看起来你还没有将 cryptswap1 变成交换分区。

mkfs.swap /dev/mapper/cryptswap1

然后您就可以初始化它:

swapon /dev/mapper/cryptswap1

现在完成说明。

相关内容