After a block device is mounted, you can view the file system information for the device via the DF or Mount command. However, sometimes it is necessary to judge without mounting the device, and the following method can be used:
(1) View file system type command: File-sl/dev/testvg/lv0 Sample output:/dev/testvg/lv0:linux Rev 1.0 ext2 FileSystem data (large files) (2) View EXT2/3 /4 File System details: command: tune2fs-l/dev/testvg/lv0 sample output (intercept part): Free blocks:1287586free inodes:327669first block:0block size:409 6Fragment size:4096reserved GDT blocks:319blocks per group:32768fragments per group:32768inodes per group:8192 PS: there's a command to display more file system Information: Dumpe2fs/dev/testvg/lv0 | Less the command displays a lot of information, preferably with less or grep using PPS: The program wants to get the file system block size and can use the STAT system call: Example: #include <stdio.h> #include <sys/ types.h> #include <sys/stat.h> int main (void) {struct STAT st; Stat ("/", &st); printf ("%d\n", st.st_blksize); return 0;}
Linux does not mount the device to obtain file system information for the device