创建一个没有安装的虚拟软盘映像? [英] create a virtual floppy image without mount?

查看:200
本文介绍了创建一个没有安装的虚拟软盘映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多文章可以显示以超级用户身份创建虚拟软盘映像文件,或者用户可以运行sudo命令.基本步骤是:

There are a lot of posts to show to create a virtual floppy image file as a super user or users can run sudo command. The basic steps are:

  1. 通过dd命令创建空的1.44MB图像文件
  2. 通过mkfs.msdos
  3. 格式化图像文件
  4. 将映像文件安装到某个安装点
  5. 将某些内容复制到安装点
  6. umount虚拟软盘映像文件
  1. create empty 1.44MB image file by dd command
  2. format the image file by mkfs.msdos
  3. mount the image file to some mount point
  4. copy something to the mount point
  5. umount the virtual floppy image file

我的问题是,如果我只是无法运行sudo命令的普通用户,我如何按照上述步骤创建虚拟软盘映像并在其中写一些内容?

my question is, in case I am just a common user who cannot run sudo command, how can I follow above steps to create a virtual floppy image and write something in it?

非常感谢.

推荐答案

是的,您当然可以这样做.将mtools用于FAT,将e2toolsgenext2fs用于ext2文件系统.

Yes, of course you can do this. Use mtools for the FAT and e2tools or genext2fs for the ext2 filesystems.

$ dd if=/dev/zero of=/tmp/disk1.img count=1440 bs=1k 
1440+0 records in
1440+0 records out
1474560 bytes (1.5 MB) copied, 0.00569719 s, 259 MB/s

$ /sbin/mkfs.msdos /tmp/disk1.img 
mkfs.msdos 3.0.12 (29 Oct 2011)

$ mdir -i /tmp/disk1.img
 Volume in drive : has no label
 Volume Serial Number is 9913-BFF6
Directory for ::/

No files
                          1 457 664 bytes free

$ mcopy -i /tmp/disk1.img /etc/issue.net ::/
$ mdir -i /tmp/disk1.img
 Volume in drive : has no label
 Volume Serial Number is 9913-BFF6
Directory for ::/

issue    net        28 2012-06-26  10:49 
        1 file                   28 bytes
                          1 457 152 bytes free

当然,我没有root权限.

And of course, I have no root rights.

这篇关于创建一个没有安装的虚拟软盘映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆