Realization and preparation of NTFS 1:ntfs on STM32

Source: Internet
Author: User
Tags disk usage

To make a statement about copyright, NTFS is the intellectual property product of Microsoft Corporation! I am in the spirit of learning and research to analyze it, in order to better understand the data storage technology. All of the information that is looked up is also online or even MSDN own public things, there is no reverse component in the inside, if Microsoft, or other I quoted the original author found that I copied the research results, please send a message to me in a timely manner, I will immediately delete the relevant information, thank you!

The copyright is over, and then we begin to study technology:

NTFS (New Technology file system), which is the filesystem of the WINDOWSNT environment. The new technology file system is the Windows NT family (for example, Windows 2000, Windows XP, Windows Vista, Windows 7, and Windows 8.1) such as the limited-level dedicated file system (the file system where the drive letter of the operating system must be formatted as NTFS file system, 4096 cluster environment). NTFS replaces the old FAT file system.

NTFS has made several improvements to fat and HPFS, such as supporting metadata and using advanced data structures to improve performance, reliability, and disk space utilization, and to provide several additional extensions ...

There are many advantages to NTFS, such as larger single partitions, larger file sizes, more files in a single directory, and so on. But if only these, Microsoft's genius is not necessary to develop a file system alone, FAT64 enough, if 64 is not enough, perhaps also appear fat128,fat256,ntfs advantages mainly embodied in reliable, safe and efficient several aspects;

  1. NTFS is a recoverable file system. Users rarely need to run disk hotfixes on NTFS partitions. NTFS guarantees partition consistency by using standard things-handling logs and recovery techniques. NTFS uses log files and checkpoint information to automatically recover file system consistency when a system failure event occurs;
  2. NTFS supports compression of partitions, folders, and files. Any Windows-based application that reads and writes compressed files on an NTFS partition does not need to be decompressed by another program, and when the file is read, the file is automatically decompressed and the file is automatically compressed when it is closed or saved;
  3. NTFS uses smaller clusters, which can be used to manage disk space more efficiently. In the case of the FAT32 file system of Win 2000, the size of the cluster is 4KB when the partition size is 2GB~8GB, the size of the cluster is 8KB when the partition size is 8GB~16GB, and the cluster size is 16KB when the partition size is 16GB~32GB. While the NTFS file system of Win 2000, when the size of the partition is below 2GB, the cluster size is smaller than the corresponding FAT32 cluster, and when the partition size is above 2GB (2GB~2TB), the cluster size is 4KB. By contrast, NTFS can manage disk space more efficiently than FAT32, minimizing the waste of disk space;
  4. On NTFS partitions, you can set access permissions for shared resources, folders, and files. Licensing settings include two things: what groups or users are allowed to access folders, files, and shared resources, and what level of access the group or user who has access permissions can have. The settings for access permissions apply not only to users on the local computer, but also to network users who access files through shared folders on the network. Security is much higher than accessing a folder or file under the FAT32 file system. In addition, in the NTFS-formatted win 2K OS, the application Audit policy can audit folders, files, and Active Directory objects, audit results recorded in the security log, through the security log can see which groups or users of the folder, file or Active Directory object level of operation, To find out the possible illegal access to the system, by taking appropriate measures to minimize this security risk. These are not implemented under the FAT32 file system;
  5. Disk quota management is available under the NTFS file system for win 2K or more. Disk quotas are quotas that administrators can use to limit the amount of disk space a user can consume, and each user can only use disk space in the maximum quota range. After you set up disk quotas, you can track and control the disk usage for each user, and you can take action by monitoring users who exceed the quota alarm threshold and quota limits. The provision of disk quota management makes it easy for administrators to allocate storage resources to users, and to avoid possible system crashes due to runaway use of disk space and improve the security of the system.
  6. NTFS uses a "change" log to track changes that occur to the record file.

If the above points do not understand, then I briefly say a few personal views: the first is the compression decompression problem, for our deep embedded system, or not compressed good, although it is NTFS with compression, but also to occupy the CPU compression/decompression, but this feature, Allows us to flexibly deploy NTFS in places with high CPU performance + low disk performance or low CPU performance + high disk performance; The 2nd is the recovery problem, in the deep embedded system, it is likely that there is no OS, or only using RTOs (ucos1,2,3, FreeRTOS, Vxworks , Rtthread, etc.), which puts the test on the completeness of the system data operation. There is no doubt that NTFS's self-recovery features have a significant advantage over the FAT file system, and that NTFS logs have a good effect on unintended accidents, such as breakpoints, accidental resets, and so on, and NTFS does not log events until the end of the event, so that our system can detect the last failure location during the restart process , and continue the last operation, minimizing the destructive effect, the 3rd is the efficiency problem, NTFS has a lot of properties, properties, properties, Properties ... When loading an NTFS file, the properties of a file have been read directly, even if the file is deleted or not present, and the FAT file system is read by the file allocation table-chain search-access to the file.

But the disadvantage and advantage of NTFS is the relative existence, the most deadly point of NTFS is that he is for high-performance CPU and not only dozens of to hundreds of MPs MCU, which caused the NTFS read-write cycle will be the president's unthinkable, but fortunately--ntfs by us to achieve, We can set a series of macro switch to determine whether our thin NTFS disk quota, or to compress, do not read and write each time to check the sector is correct (of course, this does not check will be more dangerous), and so on.

Our goal is to read and write NTFS-formatted Removable storage media, such as SD cards, on the MCU, ARM, DSP, or SOC platforms.

Figure 1 SD card formatted into NTFS format

The basics of NTFS are done, and here's the preparation, and we need two major categories of preparation: hardware and software.

I use ANSI C to implement the original purpose of NTFS is to allow my stm32f103 to read NTFS-formatted files, so on the hardware, we need an SD card, such as my 8GB TF card and SD card each one. A deep embedded development platform is also required. Before repeatedly referring to "deep embedded", then what is deep embedded? I am here to distinguish it from the general embedded logo, general embedded systems, such as linux,wince, which can be directly embedded in the NTFS plug-in, or bring NTFS, it is not necessary for us to implement the NTFS, only those layers of deeper embedded, such as RTOs, We write NTFS as a file system to insert the library in order to mention significant performance, security improvements.

In the hardware platform this, I used to have done a product of the board, the main MCU is STM32F103ZET6, the board design time to consider the hardware compatibility, can be directly replaced by the f407z series, of course, now or ZET6, back if the NTFS can not run up, and then change F407. The board has a 34-pin LCD screen, two LEDs, an RTC, a TF card slot, a TTL level of the serial port, these peripherals are enough to do a lot of things.

Software, disk tools I use Diskgenius V4.9.1.334 x64 Professional Edition, disk data read software is Winhex 14,stm32 development environment is Keil MDK 5.21a, because NTFS does not have to be developed for how long, So direct download to STM32 is not likely, time consuming laborious also cost chip, so need a PC C language IDE, I use is codeblocks editor +mingw compiler.

The tools are almost all there, and this chapter is over.

The next section describes some of the disk system's underlying and NTFS frameworks.

Realization and preparation of NTFS 1:ntfs on STM32

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.