Skip to main content
  • 产品
  • Software evaluation
  • 下载
  • Free utilities
  • 购买
  • 芯片厂商
  • 支持
  • 关于我们
  • Search
  • 工作机会
  • 新闻简报
  • 联系我们
  • emFile
  • RAID 1

    RAID 1

    Maximize data integrity & reliability with RAID 1

    • Recover data after storage device failures
    • Use with FAT and EFS across different storage media
    • Support all emFile storage media
    Contact us Downloads Documentation
    SEGGER emFile
    1. 1.Overview
    2. 2.Key features
    3. 3.NAND flash error recovery
    4. 4.Sector data synchronization
    5. 5.Sample configuration

    Overview

    emfile raid1

    The emFile RAID 1 add-on provides data redundancy by maintaining a copy of all data on a separate mirror partition. Typically, the master and mirror partitions reside on separate storage devices to provide operational redundancy.

    During normal operation, data is written to both the master and mirror partitions. If a hardware defect or storage device failure makes data on the master partition unavailable, it can be recovered from the mirror. When the system starts, RAID 1 checks the state of both partitions and restores the master partition from the mirror if required.

    RAID 1 works with both FAT and EFS and can be used with all storage media supported by emFile, including flash memory with an FTL as well as SD cards. When two separate storage devices are used, the RAID volume size is determined by the smaller device, and both devices must use the same sector size. Alternatively, the master and mirror partitions can reside on the same storage device.


    Key features

    • Provides protection from storage device defects / failures
    • Works on the storage layer with both FAT and EFS file systems
    • Can be used with any storage device supported by emFile (such as NAND, NOR, and SD cards)
    • Can use different storage types for partitions
    • Can locate all partitions on the same storage device

    NAND flash error recovery

    The Universal NAND driver can make use of the RAID 1 add-on to avoid a data loss when an uncorrectable bit error occurs during a read operation. In case of an uncorrectable bit error the Universal NAND driver requests the RAID 1 add-on to provide corrected sector data from the mirror partition. This procedure applies to read requests coming from the file system as well as for read operations performed internally by the Universal NAND driver when the data of a NAND block is copied to another location.


    Sector data synchronization

    An unexpected reset which interrupts a write operation may lead to a data inconsistency. It is possible that the data of the last written sector is stored only to the master, but not to the mirror partition. After restart, the file system will continue to operate correctly but in case of a read error affecting exactly this sector, old data is read from the mirror partition which may cause a data corruption. This situation can be prevented by synchronizing all the sectors on the RAID volume. The application can perform the synchronization by calling the FS_STORAGE_SyncSectors() API function. For example, a low priority task can call the function in parallel to other file system activities.


    Sample configuration

    The following code snippet shows how to configure a the RAID add-on to use two NAND storage devices as master and mirror partition respectively.

    /*********************************************************************
    *
    *       Defines, configurable
    *
    **********************************************************************
    */
    #define ALLOC_SIZE      0x8000              // Size of the memory pool in bytes
    
    /*********************************************************************
    *
    *       Static data
    *
    **********************************************************************
    */
    static U32 _aMemBlock[ALLOC_SIZE / 4];      // Memory pool used for
                                                // semi-dynamic allocation.
    /*********************************************************************
    *
    *       FS_X_AddDevices
    *
    *  Function description
    *    This function is called by the FS during FS_Init().
    *    It is supposed to add all devices, using primarily FS_AddDevice().
    *    
    *  Note
    *    (1) Other API functions
    *        Other API functions may NOT be called, since this function is called
    *        during initialization. The devices are not yet ready at this point.
    */
    void FS_X_AddDevices(void) {
      //
      // Give the file system some memory to work with.
      //
      FS_AssignMemory(&_aMemBlock[0], sizeof(_aMemBlock));
      //
      // Set the file system sector size.
      //
      FS_SetMaxSectorSize(2048);
      //
      // Add and configure the NAND driver for the master storage.
      //
      FS_AddDevice(&FS_NAND_UNI_Driver);
      FS_NAND_UNI_SetPhyType(0, &FS_NAND_PHY_ONFI);
      FS_NAND_UNI_SetECCHook(0, &FS_NAND_ECC_HW_NULL);
      //
      // Add and configure the NAND driver for the mirror storage.
      //
      FS_AddDevice(&FS_NAND_UNI_Driver);
      FS_NAND_UNI_SetPhyType(1, &FS_NAND_PHY_ONFI);
      FS_NAND_UNI_SetECCHook(1, &FS_NAND_ECC_HW_NULL);
      //
      // Add and configure the RAID driver.
      //
      FS_AddDevice(&FS_RAID1_Driver);
      FS_RAID1_Configure(0, &FS_NAND_UNI_Driver, 0, &FS_NAND_UNI_Driver, 1);
    }
    • User manual
    • Online documentation
    • List of downloads
    • Download for evaluation
    • Release notes
    • Update notification
    • Pricing
    • Support
    • Silicon vendor resources

    全球总部

    德国: SEGGER Microcontroller GmbH

    地址: Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    电邮: info@segger.com
    电话: +49-2173-99312-0
    传真: +49-2173-99312-28

    网点分布

    中国:哲戈微系统科技(上海)有限公司

    地址: 中国上海市闵行区秀涟路133号
    大虹桥国际A 栋218室
    邮编201199
    电邮: china@segger.com
    电话: +86-133-619-907-60


    简易信息聚合
    ISO 9001
    ISO 27001
    First-class embedded software tools since 1992
    Designed and made in Germany
    • 版本说明
    • 免责声明
    • 行为准则
    • 隐私策略
    • 沪ICP备2022005181号
    • 沪公网安备 31011202014525号
    © 2026 SEGGER - 版权所有.

    您即将离开 segger.cn 而访问境外网站,是否继续?