Thursday 31 January 2013

Linux File system

VIRTUAL FILE SYSTEM
Linux has a virtual file system(VFS) , which is sort of a kernel layer which is responsible in providing a common interface all file systems.Thus you can invoke file related system calls (reading,writing etc) to different file systems be it  ext3,ext4,VFAT etc.
Those of you using windows as well as linux in your machine would know that you can mount a windows defined C drive (FAT or NTFS) in linux environment but windows dosen't allow you to mount linux (ext*) file system (Use ext2explore software for mounting ext2 in windows).

Thus all your file related system calls is screened by a VFS , what it does is,it observes the system call to a particular file system and handles the structural manipulations and translates the user system call to physical file system code which then can be used to perform the file chores for a given file system.


Thus the VFS stores information related to mounted file system,such as blocksize,inode and dirty flag etc.Which it uses while translating system call to file specific commands


INODES
All resources in linux such as hard disks, serial ports, memory etc are treated as file objects.Each file is represented by a structure called inode.Inode contains all information about the file such as file type,access rights,time stamps,size etc.



The directories are implemented as files composed of list of entries ,each indicating the inode number and file name,where each entry identifies a file in the directory.

6 comments:

  1. Hi when I insert my phone and type 'lsusb' I find that it is showing up there. However when I try to access it , it doesn't mount and also it is not showing up when I type "sudo fdisk -l"

    Has it got something to b do with the filesystem ?

    When I Google I find it is due to the phone needing a different protocol etc.

    ReplyDelete
  2. sudo fdisk -l will list out files representing resources like /dev/sda* , you may not recognize your phone from this.

    type mount , it will list out all those which have been mounted.You can search for your phone there.
    or try mount | grep (phone name) without brackets

    For example if i insert a KINGSTON pen drive, mount | grep KING would show me details pertaining to the pendrive



    ReplyDelete
    Replies
    1. Oh thanks I didn't know mount could be used that way.

      Another thing what I was doing was checking the syslog

      sudo tail -f /var/log/syslog if I remember correctly and make out the correct device

      Pen drive shows up and phone too. But I am able to mount the pen drive but not the phone !!!!


      Delete
  3. You may have to go to usb settings/utilities in your phone and have to enable usb mass storage, This will then allow the storage to act as a file system.
    Have you done that ?

    ReplyDelete
  4. Yes I believe I have the proper settings. It s in mass storage mode.

    ReplyDelete

  5. Just saw man page of mount (man mount ,in terminal would throw a man page)

    The standard form of the mount command, is

    mount -t type device dir


    Lets check the type of file system of your phone by

    df -T

    will provide a list of file system along with their type,search for file system type of your phone here.
    Then use

    mount

    it would list out all the devices , your phone would appear to linux as /dev/file . search for the specific device name.

    Then mount -t type /dev/file /mnt


    If that didn't work

    What are you trying to mount ? is it a sd card of your phone?
    which version of linux you are using ?

    Kindly provide here, output for

    mount
    sudo fdisk -l
    dmesg

    note these command coughs up a huge chunk of data, try this command>filename , then in the texteditor search for your phone and provide data relevant here.

    PS: Also make sure, your phone usb settings has been set to mass storage.
    Is it an Android phone ?, if so then you have to opt for usb debugging
    (Application->development->usb debugging)
    Then click Usb connected to allow file transaction,if it is done right the app in your phone itself will ask whether you want to mount your phone!!

    ReplyDelete