Create Linux Loopback File System On Disk File
来源:互联网 发布:手机淘宝怎样朋友代付 编辑:程序博客网 时间:2024/05/14 08:39
CreateLinux Loopback File System On Disk File – Walker News
http://www.walkernews.net/2007/07/01/create-linux-loopback-file-system-on-disk-file/
Can you create a Linux file system without using partition DIRECTLY – sort of file system within file system management?
The answer is certainly YES!
With a loopback device in Linux (a feature that’s not natively available in Windows Vista and its predecessors) one can easily create a Linux loopback file system on a regular disk file, and not directly using a disk partition!
How to create a Linux loopback file system with a regular disk file?
To complete this Linux tricks, you need to login with a root user ID for all the steps given below
- Type
dd if=/dev/zero of=/virtualfs bs=1024 count=30720
to create a 30MB disk file (zero-filled) called virtualfs in the root (/) directory - Type
losetup /dev/loop0
to confirm that the current system is not using any loopback devices. Replace /dev/loop0 with /dev/loop1, /dev/loop2, etc, until a free Linux loopback device is found. In this case, let’s assume that /dev/loop0 is free for usage - Tpye
losetup /dev/loop0 /virtualfs
to attach the first Linux loopback device (/dev/loop0) with regular disk file (/virtualfs) created in step 1 - Type
echo $?
to confirm the previous step is completed successfully without error – a zero will be returned to indicate success. Alternative, typelosetup /dev/loop0
to confirm - Type
mkfs -t ext3 -m 1 -v /dev/loop0
to create a Linux EXT3 file system with 1%reserved block count on the loopback device that’s currently associated with a regular disk file. Hence, we are creating a file system within file system, or creating a file system (mkfs) without using a disk partition directly - Type
mkdir /mnt/vfs
to create a directory (as mount point) in /mnt - Type
mount -t ext3 /dev/loop0 /mnt/vfs
to mount the loopback device (regular disk file) to /mnt/vfs as a “regular” Linux EXT3 file system! Now, all the Linux file system-related commands can be act on this unusual Linux file system. For example, you can typedf -h
to confirm its “disk usage”, typetune2fs -l /dev/loop0
to print its file system settings, create / remove files or directories, etc. - To un-mount the loopback file system, type
umount /mnt/vfs
follow withlosetup -d /dev/loop0
to effectively remove the loopback file system and release loopback device subsequently.
0 0
- Create Linux Loopback File System On Disk File
- linux 下 eclipse 创建avd 出错 failed could not create temp file for system NAND disk
- nand could not create temp file for system nand disk image file exists
- 解决错误:NAND: could not create temp file for system NAND disk image: No such file or directory
- 解决错误:NAND: could not create temp file for system NAND disk image: No such file or directory
- The disk contains an unclean file system\
- Manually and automatically mount windows file system on Linux
- Creating a Root File System for Linux on OMAP35x
- How should I run fsck on a Linux file system
- Linux file system hierarchy
- Linux File System - Basics
- linux file system
- Embedded Linux - File System
- Linux file system superblock
- linux file System directory
- linux file System inode
- Linux File System浅析
- linux file system
- DM6437外设
- PAT 1082. Read Number in Chinese (25)
- AJAX传递数组到后台处理
- C#代码修改图片分辨率大小
- Activity状态的保存和保持( onRetainNonConfigurationInstance 和 getLastNonConfigurationInstance )
- Create Linux Loopback File System On Disk File
- 什么是Web
- 标准C++中的string类的用法总结
- Python——Pig Latin
- ant build.xml
- ubuntu/mint 使用cmake报找不到zlib和openssl库错误的解决办法
- APUE:进程:wait、waitpid
- iOS 面试题(五)
- Linux软连接和硬链接