1

On Ubuntu 14.04, I am checking the filesystem for my home based on a file new in it:

$ stat -f new
  File: "new"
    ID: 38d4cd29e44142c6 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 144152970  Free: 79424314   Available: 72095994
Inodes: Total: 36626432   Free: 35430143

I am also checking it by another way:

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb3 during installation
UUID=8620616e-3745-420e-9082-c6f9df5b0f15 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sdb4 during installation
UUID=bcd7575f-97d7-47f8-951a-83675195061c /home           ext4    defaults        0       2
# swap was on /dev/sdb2 during installation
UUID=aba3f8f2-9a25-4ef3-96ba-c12b40622eca none            swap    sw              0       0

Added: another way:

$ stat  new
  File: ‘new’
  Size: 928         Blocks: 8          IO Block: 4096   regular file
Device: 804h/2052d  Inode: 28188755    Links: 1
Access: (0622/-rw--w--w-)  Uid: ( 1000/       t)   Gid: ( 1000/       t)
Access: 2015-12-19 06:33:07.842559147 -0500
Modify: 2013-06-11 12:54:44.944836000 -0400
Change: 2015-03-25 11:15:20.778708140 -0400
 Birth: -
  1. What does ID mean in the out put of stat -f? Is it the filesystem ID of the filesystem in my home partition?

    What does it depend on? Not on the mount point?

  2. What does the first column in /etc/fstab? is it the filesystem ID of each filesystem?
  3. What are the differences between the two kinds of ID given by the two ways?

  4. why does stat -f show the file system type is ext2/ext3 while my home filesystem type is ext4?

  5. Added: what does Device mean in the output of stat without -f? Is it an id of something?

1
  1. According to man stat the ID is the ID of the filesystem, whatever that may or may not mean. I'm guessing this is generated when the filesystem is.

  2. The first column references the partition UUID, not the filesystem ID. It's a departure from the more traditional /dev/sdXX, mostly because with modern systems it's sometimes possible for the traditional drive order to be shuffled around in the BIOS, but the UUID will remain the same.

  3. As 1) and 2) point out, they're different IDs denoting entirely different aspects. They're roughly as related as your Social Security Number and your home address in that they're both associated with you, but that's it.

  4. Because ext4 is an extension to ext3 which is an extension to ext2. The part of the signature that stat looks at is the same in each case, hence the identification.

  5. Again, according to man stat, when you omit '-f' stat looks at the file itself rather than the filesystem it's on, and the value after 'Device' is the hex-and-decimal value of the filesystem's device ID. I should probably also point out that with stat -f you did not in fact get the information about the filesystem you wanted to get information about.

Yes, but what does this all mean?

A UUID is assigned by the partition manager when you create the partition. You can change it manually if you want but there's almost never a reason to and generally every reason not to. Modern linux systems prefer to use the UUID rather than the device number to determine what is mounted where, just in case new hardware is added which changes the device letter ordering. See here for more information about UUIDs.

A device id is the combination of major and minor number that identifies that particular block device. In your case, '804' identifies the fourth partition of the first SCSI-like drive located according to the BIOS. In traditional terms, this would be /dev/sda4.

They are two different ways of identifying the same thing, via different methods -- /dev/sda4 will always point to the fourth partition on the first SCSI-like device, which can fail spectacularly if you add another hard drive to your system and for some reason the BIOS identifies it first; UUID=8620616e-3745-420e-9082-c6f9df5b0f15 refers to the partition in your system with that unique identifier, regardless of how your devices are shifted around internally.

  • Thanks. In 4, what does signature mean? I still don't understand why stat doesn't show ext4 as type. – Tim Jan 21 '16 at 14:09
  • Is filesystem id inherent to a filesystem? Is partition uuid inherent to a partition? – Tim Jan 21 '16 at 14:11
  • what does Device mean in the output of stat without -f? Is it an id of something? – Tim Jan 21 '16 at 14:44
  • Is Device the id of a partition not of a device? (I have several partitions in the same device, and Device is different for files in different partitions). If yes, why is Device not the same as the partition UUID in /etc/fstab? – Tim Jan 21 '16 at 15:01
  • Because it's another way of describing the device node. – Shadur Jan 21 '16 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.