lsblk vs blkid to fetch UUID
anchal agarwal <[email protected]>
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <CAGppiHZvn-vgiQczdTyG+F3-jwzSAMB=Kwf+jFa7UWmF_68-wQ@mail.gmail.com> |
Hi, I have a use case which involves imaging of a system using custom scripts. Imaging involves installing an operating system and formatting all the disks and setting up a File System. At times I would like to enable LUKS on certain disk partitions, so I format the partition using cryptsetup to setup luks format. However, I had been seeing issues with fetching UUID post luksFormat using lsblk. I have seen the same issue with blkid but its occurrences are exponentially less. I want to use lsblk because its faster but seems like blkid is more reliable here. From what I understood from the code, blkid opens a FD for the device and reads directly from super block; however, going through the code of lsblk.c I see lsblk_device_get_properties() gets it from various methods. I am slightly confused as at that point in time the device database is not set up so is lsblk fetching the UUID the same way as blkid does using libblkid? Any information on this will be helpful. Please correct me if my understanding is incorrect. Thanks & Regards, Anchal Agarwal