FreeBSD Floppy operation

Source: Internet
Author: User
Tags file system

FreeBSD support for floppy disk operation, although the importance of floppy disk on the current computer has been greatly reduced, but in a small amount of data transfer, floppy disk is still an effective tool. You can use a UFS file system or a Msdos file system on a floppy disk.

Creating a UFs file system on a floppy disk requires using Fdformat as a low-level format for the floppy disk, using Disklabel to establish a file system label, and then using NEWFS to initialize the file system and then using mount to install it to the directory tree:

# fdformat /dev/rfd0
Format 1440K floppy `/dev/rfd0'? (y/n): y
Processing VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV done.
# disklabel -r -w fd0 fd1440
# newfs /dev/rfd0
Warning: Block size restricts cylinders per group to 6.
Warning: 1216 sector(s) in last cylinder unallocated
/dev/rfd0:   2880 sectors in 1 cylinders of 1 tracks, 4096 sectors
1.4MB in 1 cyl groups (6 c/g, 12.00MB/g, 736 i/g)
super-block backups (for fsck -b #) at:
32,
# mount /dev/fd0 /A

You must use UMOUNT/A to uninstall the floppy disk after the operation is complete.

You can also install and uninstall an existing MSDOS-formatted floppy disk and access it directly.

# mount -t msdos /dev/fd0 /A
# ls /A
# umount /A

Using the Mtools tool to build a Msdos file system on a floppy disk and access it, the floppy disk device is not installed on the directory tree, and the floppy disk is accessed Mtools using raw methods. Mtools commands are the same as the corresponding DOS commands, except that each command starts with M and is in lowercase. such as Mdir corresponding to the dos dir command, MCD corresponding to the DOS CD command, mcopy corresponding to the DOS COPY, and can FreeBSD file system and DOS floppy disk transfer between files, and so on.

# mformat A:
# mdir A:
# mcopy hello.c A:

However, the text format of DOS is different from UNIX, and only newline characters are used under Unix for line breaks, while the use of line breaks and carriage return characters are used in DOS. So if you copy dos files to UNIX, it can sometimes cause a little bit of trouble. If you open this file under VI, you may see this result:

main(){ ^M
printf(“Hello! World!”); ^M
}^M

^m represents a newline character, and the-t parameter is added to the mcopy to eliminate these problems when copying files between different file systems. If you remove newline characters from existing files, you can use pattern substitution directly in VI to eliminate this special character (using ^v^m to represent this special character, that is, to enter V and m while pressing the CTRL key), or to use the TR command:

$ tr -d “\015” < hello.c > hello.unix.c

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.