Created attachment 170723 [details] Added G flag. In the superblock of the filesystem present unique id: /usr/include/ufs/ffs/fs.h /* * Super block for an FFS filesystem. */ struct fs { ... int32_t fs_id[2]; /* unique filesystem id */ ... It's may by used to mount filesystem (/dev/ufsid/...). After duplicating the disc, it is necessary to change it, to restore the uniqueness drives.
Hello. To generate a new ufsid I used an algorithm from a file: /usr/src/sbin/newfs/mkfs.c 140 time(&utime); 465 sblock.fs_id[0] = (long)utime; 466 sblock.fs_id[1] = newfs_random(); 1149 /* 1150 * For the regression test, return predictable random values. 1151 * Otherwise use a true random number generator. 1152 */ 1153 static u_int32_t 1154 newfs_random(void) 1155 { 1156 static int nextnum = 1; 1157 1158 if (Rflag) 1159 return (nextnum++); 1160 return (arc4random()); 1161 }
It's patch applied to FreeBSD 11, Revision: 301300.
That's indeed the missing bit when you dd an entire partition (copying ufs meta data verbatim) - but then we need to distinguish the copied partition from the original. Thanks, please commit.