用dd复制btrfs分区后的调整

btrfs分区, 在有很多快照和子卷的情况下, 用dd来做复制, 是最快速的。但是dd会造成分区的uuid重复, 在系统中造成混乱。

这时候需要修改一下新的btrfs分区的uuid, btrfs命令没有提供修改uuid的功能,需要用btrfstune命令来修改 uuid

对于内核大于5的时候, 使用

 btrfstune -m /dev/xxx
内核小于5时,使用
 btrfstune -u /dev/xxx

#btrfstune -u /dev/mapper/vg0-bak_home
Warning: It's highly recommended to run 'btrfs check' before this operation
Also canceling running UUID change progress may cause corruption
We are going to change UUID, are your sure? [y/N]: y 
Current fsid: 2a44dee0-7af4-4336-b57f-c02b2858b5ee
New fsid: de158bd6-2c5e-4695-8b57-6701db5ccd78
Set superblock flag CHANGING_FSID
Change fsid in extents
Change fsid on devices
Clear superblock flag CHANGING_FSID
Fsid change finished
 
 
ext4,ext3,ext2格式, 用tune2fs -U 来修改uuid