Can we create a file system (i.e. formatting a drive/partition) with in a file system?
Looks little bit strange is int it? So follow me I will show you how to create a virtual partition and file system within a partition.
Step1 : Create a empty file with /dev/zero with size equal to 50Mb.#dd if=/dev/zero of=/temp/vf0 count=102400
Note :
1. By default "dd" command(dataset definition) uses block of 512bytes so the size will be 102400*512=52 428 800=~50MB
2. /dev/zero is a device files which will be used create a file which conations "0" i.e. an empty file.Clipped output:[root@test6 ~]# dd if=/dev/zero of=/temp/vf0 count=102400
102400+0 records in
102400+0 records out
[root@test ~]# ls -lh /temp/vf0
-rw-r--r-- 1 root root 50M Nov 7 12:08 /temp/vf0
Step2 : Create ext3 file system for this virtual partition.#mkfs -t ext3 /temp/vf0
Here it will ask "do you want to format the file or not"?, just say yes.
Step3 : Now we have to create a mount point (nothing but a directory) and mount the created partition.# mkdir /virtdrive
# mount -o loop=/dev/loop0 /temp/vf0 /virtdrive
Note:
/dev/loop is special hardware device used to mount ISO files and virtual file systems. In Linux there are total 8 loop devices numbering from 0 to 7. So you can mount only 8 ISO files/virtual file systems by default.
Step4 : Edit /etc/fstab file to mount permanently, so that it be auto mounted at boot time too. Specify following entry in fstab file./temp/vf0 /virtdrive ext3 rw,loop=/dev/loop0 0 0
Step5 : Specify the fstab changes to kernel.#mount -a
Step6 : Conform Weather mounting happen perfectly or not.
Way1 :#cat /etc/mtab
Way2 : Change the directory to mount point you have to see lost+found folder[root@test ~]# cd /virtdrive/
[root@test virtdrive]# ls
lost+found
[root@test virtdrive]#
Sharing knowledge on Linux, DevOps, Middleware and Cloud Technologies!!
Subscribe to:
Post Comments (Atom)
Kubernetes 1.31 || Testing the Image Volume mount feature using Minikube
With Kubernetes new version 1.31 ( https://kubernetes.io/blog/2024/08/13/kubernetes-v1-31-release/ ) there are so many features releases for...
-
Currently, we are getting some issues while deleting the namespace in Kubernetes(AKS). When we run " kubectl delete ns " command,...
-
Jenkins has been one of the most used CI/CD tools. For every tool which we are using in our daily life, it becomes really challenges when ...
-
When you were working with some POC or R&D, you may have to do things a number of times until you come to final conclusion. In my r...
No comments:
Post a Comment