如何找到交换uuid


13

我正在进行突袭。sda在安装过程中使用,我刚才复制的分区表sdasdb像这样:

$ sudo sfdisk -dL /dev/sda > partition_table_sda
$ sudo sfdisk /dev/sdb < partition_table_sda

但是,我注意到它sda具有用于swapspace的uuid,但sdb没有:

$ sudo blkid
/dev/sda5: UUID="vvvvvvvv-wwww-xxxx-yyyy-zzzzzzzzzzzz" TYPE="swap" 
/dev/sda1: UUID="vvvvvvvv-wwww-xxxx-yyyy-zzzzzzzzzzzz" TYPE="ext4" 
/dev/sdb1: UUID="vvvvvvvv-wwww-xxxx-yyyy-zzzzzzzzzzzz" TYPE="ext4"

尽管该分区看起来正确,但是只是缺少了uuid:

$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0xzzzzzzzz

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   960002047   480000000   83  Linux
/dev/sda2       960004094   976771071     8383489    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5       960004096   976771071     8383488   82  Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0xzzzzzzzz

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048   960002047   480000000   83  Linux
/dev/sdb2       960004094   976771071     8383489    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sdb5       960004096   976771071     8383488   82  Linux swap / Solaris

那么,如何为交换空间分配一个uuid sdb5?或者,如果已经有uuid,该如何打印出来?

Answers:


14

您格式化了交换分区吗?分割磁盘并为交换保留分区后,您必须:

sudo mkswap /dev/sdb5

之后,在输入blkid命令时应显示交换的UUID 。


啊,我没有意识到。我明天会
试一试
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.