Create a floppy image file in Linux

Source: Internet
Author: User

First, generate a blank floppy disk image:
Dd If =/dev/Zero of = data. img bs = 512 COUNT = 2880

Use the losetup command to use data. IMGLoop DeviceUsage:
Sudo losetup/dev/loop0 data. img

Then, format the loop device:
Sudo mkfs. msdos/dev/loop0

Check the file system:
Sudo fsck. msdos/dev/loop0

Delete loop device:
Sudo losetup-D/dev/loop0

At this time, Data. IMG has been formatted and can be used as a floppy disk image, for example, mounted to mountdir with sudo Mount-o loop data. IMG mountdir. After certain permissions are set, you can use the virtual machine to open the disk image and use the image as a shared directory. Although this file is only 1.44 MB in size, however, in some cases, the requirements can be met.

 

There are some special device files. For example, the/dev/Zero file represents a device file that always outputs 0. You can use it as an input to obtain all files that are empty. Therefore, you can create new files and overwrite old files to clear them. The following command uses the DD command to create a 10 KB file from the zero device (BS determines that 1024 bytes are read and written each time, Count defines that the number of reads and writes is 10 times), but the content is all 0 files.

# Dd If =/dev/Zero of = file COUNT = 10 BS = 1024

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.