博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
11.10. loop devices
阅读量:6295 次
发布时间:2019-06-22

本文共 2365 字,大约阅读时间需要 7 分钟。

If you are using the loadable module you must have the module loaded first with the command:

$ sudo modprobe loop

The following commands can be used as an example of using the loop device.

$ dd if=/dev/zero of=file bs=1k count=100100+0 records in100+0 records out102400 bytes (102 kB) copied, 0.00126554 s, 80.9 MB/s$ sudo losetup /dev/loop0 file$ sudo mkfs.ext3 /dev/loop0mke2fs 1.40.8 (13-Mar-2008)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)16 inodes, 100 blocks5 blocks (5.00%) reserved for the super userFirst data block=11 block group8192 blocks per group, 8192 fragments per group16 inodes per groupWriting inode tables: doneFilesystem too small for a journalWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 24 mounts or180 days, whichever comes first.  Use tune2fs -c or -i to override.

mount loop device

$ sudo mkdir /mnt/loop$ sudo mount /dev/loop0 /mnt/loop

Now! you can using it as harddisk.

umount loop device

$ sudo umount /mnt/loop/$ sudo losetup -d /dev/loop0

Maybe also encryption modules are needed.

$ sudo modprobe cryptoloop$ sudo modprobe des

enable data encryption

$ dd if=/dev/zero of=encryption_file bs=1k count=100100+0 records in100+0 records out102400 bytes (102 kB) copied, 0.00130537 s, 78.4 MB/s$ sudo losetup -e des /dev/loop0 encryption_file

If you are using the loadable module you may remove the module with the command

$ sudo rmmod loop des cryptoloop

11.10.1. losetup - set up and control loop devices

EXAMPLE

If you are using the loadable module you must have the module loaded first with the command              # insmod loop.o       Maybe also encryption modules are needed.              # insmod des.o # insmod cryptoloop.o       The following commands can be used as an example of using the loop device.              # dd if=/dev/zero of=/file bs=1k count=100              # losetup -e des /dev/loop0 /file              Password:              Init (up to 16 hex digits):              # mkfs -t ext2 /dev/loop0 100              # mount -t ext2 /dev/loop0 /mnt               ...              # umount /dev/loop0              # losetup -d /dev/loop0       If you are using the loadable module you may remove the module with the command              # rmmod loop

原文出处:Netkiller 系列 手札

本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

你可能感兴趣的文章
javascript 中出现missing ) after argument list的错误
查看>>
使用Swagger2构建强大的RESTful API文档(2)(二十三)
查看>>
Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work
查看>>
(转)第三方支付参与者
查看>>
程序员修炼之道读后感2
查看>>
DWR实现服务器向客户端推送消息
查看>>
js中forEach的用法
查看>>
Docker之功能汇总
查看>>
!!a标签和button按钮只允许点击一次,防止重复提交
查看>>
(轉貼) Eclipse + CDT + MinGW 安裝方法 (C/C++) (gcc) (g++) (OS) (Windows)
查看>>
还原数据库
查看>>
作业调度框架 Quartz.NET 2.0 beta 发布
查看>>
mysql性能的检查和调优方法
查看>>
项目管理中的导向性
查看>>
Android WebView 学习
查看>>
(转)从给定的文本中,查找其中最长的重复子字符串的问题
查看>>
HDU 2159
查看>>
spring batch中用到的表
查看>>
资源文件夹res/raw和assets的使用
查看>>
UINode扩展
查看>>