I'm experiencing a weird situation on RHEL-7. I create a device mapper (crypt) over a disk partition and then copy data (bytes) from disk partition to mapper. The blkid output has two entries for the UUID - one for disk partition and other for mapper. The UUID under /dev/disk/by-uuid points to mapper as it was overwritten.
blkid output:
/dev/sdc1: UUID="1e762c4a-0b12-40fc-9f53-a825016211a0" TYPE="ext4"
/dev/mapper/my_mapper: UUID="1e762c4a-0b12-40fc-9f53-a825016211a0" TYPE="ext4"
/dev/disk/by-uuid output:
lrwxrwxrwx 1 root root 10 Jan 31 10:24 1e762c4a-0b12-40fc-9f53-a825016211a0 -> ../../dm-4
Now, I again copy data (bytes) from mapper to disk partition and close the mapper. The UUID under /dev/disk/by-uuid points to disk partition and blkid output shows UUID for the disk partition.
blkid output:
/dev/sdc1: UUID="1e762c4a-0b12-40fc-9f53-a825016211a0" TYPE="ext4"
/dev/disk/by-uuid output:
lrwxrwxrwx 1 root root 10 Jan 31 10:24 1e762c4a-0b12-40fc-9f53-a825016211a0 -> ../../sdc1
but, once I try to mount the disk partition, I get the error:
mount -t ext4 -o rw /dev/sdc1 /mnt/plainDisk
mount: wrong fs type, bad option, bad superblock on /dev/sdc1.
and then the disk disappears from blkid output. The /dev/disk/by-uuid is still present with correct UUID and lsblk shows the disk.
I'm using blockdev --getsize64
to get the size of disk in bytes and then copying all these bytes.
Any inputs or pointers are appreciated. I'm not facing this issue on RHEL-6 though.
Additional Info:
- I use
fsync
over /dev/sdc1 file descriptor once all data is copied. - I verified the dumpe2fs output when /dev/sdc1 was present after second copy. It matched the original values. However, once the entry was removed, the dumpe2fs gives the error:
dumpe2fs 1.42.9 (28-Dec-2013)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1
Couldn't find valid filesystem superblock.
dmesg
say?VFS: Can't find ext4 filesystem