Reiser4 shows Type: UNKNOWN with stat -f mountpoint
I noticed that stat -f returns UNKNOWN for Type for a reiser4 filesystem, while working OK* with other filesystems. The version of stat used is 5.0. If this is the fault of the stat command and not reiser4, sorry for the noise.
[steven@spc2 testing-2.6]$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 ext3 798476 156840 601076 21% / /dev/sda8 ext3 7147260 5570588 1213608 83% /home none tmpfs 257456 0 257456 0% /dev/shm /dev/sda6 ext3 4024188 1874192 1945572 50% /usr /dev/sda7 ext3 806368 131756 633648 18% /var
/dev/sda9 reiser4 3930680 302468 3628212 8% /r4_testing
[steven@spc2 testing-2.6]$ stat -f /var
File: "/var"
ID: 0 Namelen: 255 Type: ext2/ext3
Blocks: Total: 201592 Free: 168653 Available: 158412 Size: 4096
Inodes: Total: 102592 Free: 101008
[steven@spc2 testing-2.6]$ stat -f /r4_testing
File: "/r4_testing"
ID: 0 Namelen: 3976 Type: UNKNOWN (0x52345362)
Blocks: Total: 982670 Free: 907053 Available: 907053 Size: 4096
Inodes: Total: 0 Free: 0
*well, sort of OK. Vfat systems are reported as 'vfat' by df -T, but as 'msdos' by stat -f:/dev/hda5 vfat 1.9G 920M 963M 49% /win_d
[steven@spc0 steven]$ stat -f /win_d
File: "/win_d"
ID: 0 Namelen: 260 Type: msdos
Steven
Quoted 10 lines · Steven Cole
I noticed that stat -f returns UNKNOWN for Type for a reiser4 filesystem, while working OK* with other filesystems. The version of stat used is 5.0. If this is the fault of the stat command and not reiser4, sorry for the noise.
[steven@spc2 testing-2.6]$ stat -f /r4_testing
File: "/r4_testing"ID: 0 Namelen: 3976 Type: UNKNOWN (0x52345362)Blocks: Total: 982670 Free: 907053 Available: 907053 Size: 4096
Inodes: Total: 0 Free: 0
Yes, the filesystem magic numbers are built into stat, and it probably hasn't been updated to understand reiser4 yet. This can probably be fixed by sending a patch to the fileutils/coreutils maintainers.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
Quoted 12 lines · Andreas Dilger
Quoted 10 lines · Steven Cole
I noticed that stat -f returns UNKNOWN for Type for a reiser4 filesystem, while working OK* with other filesystems. The version of stat used is 5.0. If this is the fault of the stat command and not reiser4, sorry for the noise.
[steven@spc2 testing-2.6]$ stat -f /r4_testing
File: "/r4_testing"ID: 0 Namelen: 3976 Type: UNKNOWN (0x52345362)Blocks: Total: 982670 Free: 907053 Available: 907053 Size: 4096
Inodes: Total: 0 Free: 0
Quoted 5 lines
Yes, the filesystem magic numbers are built into stat, and it probably hasn't been updated to understand reiser4 yet. This can probably be fixed by sending a patch to the fileutils/coreutils maintainers.
Cheers, Andreas
Thanks. Adding [email protected] to the cc list.
Patch to fix coreutils 5.2.1 stat for reiser4 is included below.
I got the coreutils source and fixed it. The include file is evidently automatically generated from the source .c file. From src/stat.c:
# if defined __linux__
/* IMPORTANT NOTE: Each of the following `case S_MAGIC_...:'
statements must be followed by a hexadecimal constant in a comment. The S_MAGIC_... name and constant are automatically combined to produce the #define directives in fs.h. */
I modified src/stat.c for reiser4, built coreutils and tested the new stat with reiser4. And src/fs.h did get updated automatically. How nice.
[steven@spc2 coreutils-5.2.1]$ cat src/fs.h
/* Define the magic numbers as given by statfs(2).
Please send additions to [email protected]. This file is generated automatically from ./stat.c. */
#if defined __linux__
# define S_MAGIC_AFFS 0xADFF # define S_MAGIC_DEVPTS 0x1CD1 [snipped] # define S_MAGIC_REISERFS 0x52654973 # define S_MAGIC_CRAMFS 0x28cd3d45 # define S_MAGIC_ROMFS 0x7275 # define S_MAGIC_REISER4 0x52345362 #elif defined __GNU__ # include <hurd/hurd_types.h> #endif
[steven@spc2 coreutils-5.2.1]$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 ext3 798476 156840 601076 21% / /dev/sda8 ext3 7147260 5629872 1154324 83% /home none tmpfs 257456 0 257456 0% /dev/shm /dev/sda6 ext3 4024188 1874192 1945572 50% /usr /dev/sda7 ext3 806368 131768 633636 18% /var
/dev/sda9 reiser4 3930680 302468 3628212 8% /r4_testing
[steven@spc2 coreutils-5.2.1]$ ./src/stat -f /r4_testing
File: "/r4_testing"
ID: 0 Namelen: 3976 Type: reiser4
Blocks: Total: 982670 Free: 907053 Available: 907053 Size: 4096
Inodes: Total: 0 Free: 0
Here is the patch:
Steven
src/stat.c renamed from src/stat.c.original +3 -0
@@ -217,6 +217,9 @@case S_MAGIC_ROMFS :/* 0x7275 */ type ="romfs" ;break ; +case S_MAGIC_REISER4 :/* 0x52345362 */ + type ="reiser4" ; +break ;# elif __GNU__case FSTYPE_UFS : type ="ufs" ;