[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): t
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
接下来我们使用mkswap命令将/dev/sdb1格式化为swap文件系统,然后使用命令blkid查看分区的文件系统类型。可以看出,/dev/sdb1已经是swap类型的文件系统了。下面的输出中有两点需要注意:(1)mkswap命令的输出中有wiping old xfs signature,这是因为/dev/sdb1之前已经被格式化为xfs类型的系统了;(2)blkid命令的输出中没有看到/dev/sda2与/dev/sdb2,这是因为这两个分区还没有被格式化为某种类型的文件系统。