Find the answer to your Linux question:
Results 1 to 5 of 5
Hi guys, I have been looking to parse a new block device mount point in my fedora system. Can anyone please help me with the commands to create and parse ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2011
    Posts
    10

    Smile parsing a new block device


    Hi guys,
    I have been looking to parse a new block device mount point in my fedora system.
    Can anyone please help me with the commands to create and parse a block device mount point


    Thanks !

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    What do you mean by "parse" the block device? Do you mean to mount it and examine the filesystem layout (e.g., files, directories, etc.)?

    If that's what you mean, you need the block device name, which represents your attached disk device. For example, a USB disk that gets attached might be called /dev/sdb, and might already have a partition created, called /dev/sdb1. You could get a listing of partitions already on it with:

    Code:
    fdisk -l /dev/sdb
    Check the output of dmesg for the block device name of your device. What is it that you are trying to read, anyway? Do you know it to already have a filesystem on it, or do you need to create one? If it is some odd device that the kernel cannot automatically create a block device for you, you'll have to create your own - though that doesn't happen much any more. There is a script that will help with this though, called /sbin/MAKEDEV.

    Once you know the block device partition, you can mount it manually, or sometimes the desktop (and related processes) will automount it for you, if a supported filesystem/partition is detected. Manually, it would be something like:
    Code:
    mkdir /mnt/disk
    mount -t vfat /dev/sdb1 /mnt/disk

  3. #3
    Just Joined!
    Join Date
    Aug 2011
    Posts
    10
    Thanks a lot for replying !

    I am trying to create a block device and then format it with ext4 file system using mkfs command, after that want to mount it on vfs. This is what i want to do on a high level

    One approach of doing this i feel is by creating an image file using the command:

    dd if=/dev/zero of=./disk.img bs=512 count=`python -c "print 2 * 1024 * 1024"`

    Then formatting it with ext4 file system using :

    mkfs.ext4 disk.img

    after formatting the image file, i can proceed with creating a directory by the name foobar which will act as a mount point for this image file.Using the command:

    mount -o loop disk.img foorbar

    I am confused about how to proceed from here..
    It would be great if you could suggest me something so that i can mount this directory foobar on vfs.

    Please let me know if its still unclear to you..

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Still unclear...you've created and mounted a filesystem using a virtual disk image file, that is good. You can now treat that directory as a locally mounted filesystem (to be shared out via NFS, Samba, FTP, etc.). What do you mean by "vfs" then?

  5. #5
    Just Joined!
    Join Date
    Aug 2011
    Posts
    10
    VFS is the virtual file system of linux OS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •