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 !
Printable View
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 !
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:
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.Code:fdisk -l /dev/sdb
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
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..
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?
VFS is the virtual file system of linux OS