Using files to create file systems under a Linux system, the small partners may have a bit of a clue about what it means at first blush.
In fact, the use of files to create a file system is still quite practical value
First we do some testing, when we do not want to use the actual disk partition, we can use the file to create a file system, and then do some tests on it;
Secondly, we write the data in the file system created using the file, if necessary, we can copy the file away, to achieve a convenient migration of data, and the data on the partition on the disk we want to copy away is more troublesome.
Needless to say, the following is to do a small experiment, to demonstrate the next step;
First we create a partfile file under the/testdir test directory
Fill the file with 500M size using the dd if=/dev/zero of=/testdir/partfile bs=1m count=500 command
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/86/83/wKioL1fBldjT14VFAABIvqIf94U250.png-wh_500x0-wm_3 -wmp_4-s_3622024674.png "style=" Float:none; "title=" 1 Create a test file and populate it with the DD command as 500m.png "alt=" Wkiol1fbldjt14vfaabivqif94u250.png-wh_50 "/>
Then use mkfs.ext4/testdir/partfile to format the Partfile file
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/86/83/wKiom1fBldmizIzMAAB_g3SHgag383.png-wh_500x0-wm_3 -wmp_4-s_1035520953.png "style=" Float:none; "title=" 2 formatted as EXT4 file system. png "alt=" WKIOM1FBLDMIZIZMAAB_G3SHGAG383.PNG-WH _50 "/>
Mkdir/mnt/partfile Creating a mount point
mount/testdir/partfile/mnt/partfile/-O loop mount the/testdir/partfile to the/mnt/partfile directory
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/83/wKiom1fBldrD72zBAAAhkNNHuxM742.png-wh_500x0-wm_3 -wmp_4-s_634416310.png "style=" Float:none; "title=" 3 Create a mount point directory and mount it. png "alt=" Wkiom1fbldrd72zbaaahknnhuxm742.png-wh_ "/>
viewing mount conditions
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/86/83/wKioL1fBldvxT3KYAABI--kNBU0869.png-wh_500x0-wm_3 -wmp_4-s_2323725105.png "style=" Float:none; "title=" 4 View mount status. png "alt=" wkiol1fbldvxt3kyaabi--knbu0869.png-wh_50 "/ >
In order to be able to automatically mount the boot, we need to modify the/etc/fstab configuration file
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/83/wKioL1fBldugLAqOAABVLazOnpI826.png-wh_500x0-wm_3 -wmp_4-s_2346921915.png "style=" Float:none; "title=" 5 Modify fstab File Settings boot automatically mount. png "alt=" Wkiol1fblduglaqoaabvlazonpi826.png-wh_50 "/>
This article is from the "11798474" blog, please be sure to keep this source http://11808474.blog.51cto.com/11798474/1843412
Using files to create a file system under a Linux system