Skip to main content
  • Products
  • Evaluate our Software
  • Downloads
  • Free Utilities
  • Purchase
  • Support
  • About Us
  • Blog
  • Forum
  • Search
    • Contact Us
    • Forum
    • Wiki
    • Web Shop
    • Newsletter
    • RSS
  •   Jobs
  •   Videos
  •   Blog
  •   Sustainability
  • emFile
  • RAID 1
  • Technology
  • Add-ons
  • Tools
SEGGER - Filesystem emFile Product Icon

emFile Add-Ons – Maximize Data Integrity & Reliability with RAID 1

emFile add-on maximizing data integrity and reliability

  • 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
  1. 1.About RAID
  2. 2.RAID 1 - Theory of Operation
  3. 3.NAND Flash Error Recovery
  4. 4.Sector Data Synchronization
  5. 5.Sample Configuration

About RAID

While the term R-A-I-D comes from Redundant Array of Independent (or Inexpensive) Disks, the word “recoverable” better describes the process.

emfile raid1

RAID 1 - Theory of Operation

RAID1 uses mirroring to enable data recovery. A copy of all data on the master partition is kept on a separate partition called the mirror. The master and the mirror may be on the same storage device or on separate devices. In the case of a hardware defect or failure on the master partition, data can be recovered from the mirror partition.

On a file system write request, the sector data is written to both master and mirror. On a file system read request, the RAID1 add-on reads the sector data from the master partition. In the event of a read error, the sector data is taken from the mirror partition. The data is recovered and no error is reported to the file system.

RAID1 can be configured to store the data on either the same storage devices or on two separate devices. If a single storage device is used, the first half is used as master partition. When using two different storage devices, the size of the volumes do not have to match. The number of sectors available to the file system will be that of the smallest storage device. It is, however, required that the sector size of both storage devices be equal.

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);
}

More Information

Purchase

  • Pricing

Technology

  • Performance
  • Resource usage
  • Software Structure
  • emFile Storage Layer

Add-ons

  • Device Driver IDE & Compact Flash
  • Device Driver RAM Disk
  • Device Driver SD, SDHC & MMC
  • Journaling
  • Encryption
  • RAID 1
  • RAID 5
  • BigFAT

Tools

  • Test & Debug Hardware

About us

  • The Company
  • Partners
  • Job Offers
  • Media
  • Contact us

Support

  • Technical Support
  • Blog
  • Forum
  • Wiki

Downloads

  • Application Notes
  • Embedded Studio
  • embOS
  • emCompress
  • emCrypt
  • emFile
  • emLib
  • emLoad
  • emModbus
  • emNet
  • emPower
  • emSecure
  • emSSH
  • emSSL
  • emUSB-Device
  • emUSB-Host
  • emVNC
  • emWin
  • Flasher
  • Free Utilities
  • IoT
  • J-Link / J-Trace
  • Linux Studio
  • SystemView
  • CE / REACH

Social Media

Headquarters

SEGGER Microcontroller GmbH

Ecolab-Allee 5
40789 Monheim am Rhein, Germany
info@segger.com
Tel.: +49-2173-99312-0
Fax: +49-2173-99312-28

Locations

USA: SEGGER Microcontroller Systems LLC

Boston area
101 Suffolk Lane
Gardner, MA 01440, USA
us-east@segger.com
Tel.: +1-978-874-0299
Fax: +1-978-874-0599

Silicon Valley
Milpitas, CA 95035, USA
us-west@segger.com
Tel.: +1-408-767-4068

China: SEGGER Microcontroller China Co., Ltd.

Room 218, Block A, Dahongqiaoguoji
No. 133 Xiulian Road
Minhang District, Shanghai 201199, China
china@segger.com
Tel.: +86-133-619-907-60

ISO 9001 certified

ISO 9001

30+ years of experience

First-class embedded software tools since 1992
  • Imprint
  • Disclaimer
  • Privacy Policy

© 2023 SEGGER - All rights reserved.