12

I am in the process of setting up a raid. sda was used during the installation and I just copied the partition table of sda to sdb like so:

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

However I notice that sda has a uuid for the swapspace, but sdb does not:

$ 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"

The partition looks correct though, it's just the uuid that is missing:

$ 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

So how can I assign a uuid to the swapspace sdb5? Or if it already has a uuid, how can I print it out?

14

Have you formatted the swap partition? Once you part your disk and reserve a partition for swap you have to:

sudo mkswap /dev/sdb5

after that your swap's UUID should be displayed when entering blkid command.

  • ah i didn't realize that. i will give it a go tomorrow – mulllhausen Mar 10 '15 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.