Create a virtual floppy disk image in Linux

Source: Internet
Author: User

3.5 inch 1.44m floppy disk structure:

  • 2-sided, 80-sided, 18-sector, 512-byte/sector
  • Total number of sectors = 2x80/x 18 sectors/sectors = 2880 sectors
  • Storage Capacity = 512 bytes/sector X 2880 sectors = 1440 kb = 1474560b

1. Create a virtual floppy disk image file
Any of the following three commands can create a virtual floppy disk image file with the same results:

  • Dd If =/dev/Zero of = floppy. img bs = 1474560 COUNT = 1
  • Dd If =/dev/Zero of = floppy. img bs = 512 COUNT = 2880
  • Dd If =/dev/Zero of = floppy. img bs = 1024 COUNT = 1440


2. Create a file system on the disk image file
Any of the following two commands can create a file system on a floppy disk image. You can select a file system as needed:

  • Mkfs. vfat floppy. img/* Create and format the file system as vfat */
  • Mkfs. ext2 floppy. img/* Create and format the file system as ext2 */

When an ext2 file system is created, the following message is returned: floppy. IMG is not a block special device. Proceed anyway? (Y, n) y, select y, and press Enter.

3. Read and Write the created floppy disk image
First, mount the floppy disk image to a folder and run the following command to create a folder floppy:

  • Mkdir floppy

Run the following command to mount a floppy image:

  • Mount floppy. IMG floppy-o loop/* is-o loop, not-0 loop, and it must be loop */

If the system used does not automatically recognize the file system, add the-T option to the mount command:

  • Mount floppy. IMG floppy-o loop-T vfat/* If the floppy image is a vfat File System */
  • Mount floppy. IMG floppy-o loop-T ext2/* If the floppy image is an ext2 File System */

Then, you can perform operations on the floppy folder like a normal folder, such as copying the "kernel" file to it:

  • CP kernel floppy
View the files:
  • Ls floppy/* output "kernel "*/

After the operation, run the following command to uninstall it:

  • Umount floppy. img

In this way, the previous operation is completely written into the virtual floppy disk image file.

If

Mount: Unknown filesystem type 'vfat'

You need to view and recreate

/Lib/modules/2.6.xxx/modules. Dep

Use depmod to regenerate modules. Dep and restart

 

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.