OpenBlockS™ / OpenMicroServer™

CompactFlash Card Initialization

The following manual explains how to create a partition and a file system on a CompactFlash (CF) card in the OpenBlockS266 or OpenMicroServer for use as storage.

In the following, input by the user is marked in orange. We use a 128 MB CF card as an example. For a larger size card, some numbers would be different, but the steps are the same.

Insert the CompactFlash card

Shut down and switch off the OpenBlockS266, and open the case. Insert the card into the CompactFlash port, close the case and boot the device.

Login as root. The following operations are only possible as root user.

Create a partition

  1. Unmount first
    Depending on the configuration, it is possible that the CF card is automatically mounted at boot time. To make sure that this is not the case, unmount it with the following command.
    # umount /dev/hda1
  2. Start fdisk(8)
    Start fdisk with the following command.
    # fdisk /dev/hda

    When fdisk(8) starts, it displays a screen for partition settings.

    • fdisk(8) is the standard Unix tool for partitioning a hard disk.
      /dev/hda ist the device name of the first ATA disk connected to the system. In this case, it is used for the CompactFlash card.
    • The (8) in `fdisk(8)' means that the fdisk command belongs to section 8 of the Linux manual pages.
      Note that to save space, the Linux man pages are not part of the default installation on the OpenBlockS266. You can view them either on a different Linux machine, by entering the command
      # man 8 fdisk
      You can also use one a Linux man page mirror on the Web, such as http://www.linuxmanpages.com/man8/fdisk.8.php.
  3. On the fdisk command prompt, enter `o' to clear all content from the card. With this command, all data previously stored on the card will be deleted.
    Command (m for help): o      .... initialization command

    Note that Linux fdisk(8) makes no changes on the actual disk until you enter the `w' (write) command. Only then will the specified changes be written on the medium. Before that, you can discard any changes and exit fdisk(8) by entering the `q' (quit) command. Use this if you are unsure or if you made a mistake.

  4. To create a new partition, use the `n' command.
    Command (m for help): n       .... create command
    Command action
       e   extended                       .... create an extended partition
       p   primary partition (1-4)        .... create a primary partition
  5. Enter `p' to create a primary partition
    p                             .... create a primary partition
  6. On the next screen, you are asked to select the number of the partition you wish to create. Press `1'.
    Partition number (1-4): 1     .... select a partition number
  7. Next, you are asked to specify where on the CF card you wish to create the partition. This means you have to specify the first, and then the last cylinder of the area on CF card where you create the partition.
    For this example, we use the whole CF card for one partition, so we start the partition at cylinder 1 and end it as the last. Note that fdisk(8) will give us these values as default, so we just continue by pressing enter.
    First cylinder (1-978, default 1):
    Using default value 1
  8. and
    Last cylinder or +size or +sizeM or +sizeK (1-978, default 978):
    Using default value 978
  9. To make it possible to boot from the partition you just created, you need to set the boot flag. This is done with the `a' command.
    Command (m for help): a        .... flag setting command
  10. On the next screen, you are asked to select the partition for that you wish to set the boot flag.
    Since we just created partition 1, enter `1' here.
    Partition number (1-4): 1      .... partition selection
  11. Next, verify the entered settings.
    Use the `p' command to display the partition information table.
    Command (m for help): p        .... command to display the table
    
    Disk /dev/hda: 128 MB, 128188416 bytes
    8 heads, 32 sectors/track, 978 cylinders
    Units = cylinders of 256 * 512 = 131072 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *           1         978      125168   83  Linux
    ~~~~~~~~~new partition
    • /dev/hda1 is the Linux device file name for the first partition on /dev/hda, i.e. your CF card.
  12. Check whether the settings you entered so far are correct, and use the `w' command to write the new partition table to the CompactFlash card.
    Command (m for help): w        .... write command
    
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
     hda: hda1
     hda: hda1
    Syncing disks.
    #
    
  13. Create a file system on the new partition
    Use the mke2fs(8) command to create a new ext2 file system on the new partition. ext2 is the standard Linux file system.
    # mke2fs /dev/hda1
    mke2fs(8) is started and creates an ext2 file system on the new partition.
    mke2fs 1.34 (25-Jul-2003)
     hda1
     hda: hda1
     hda: hda1
    Filesystem label=
    OS type: Linux
    Block size=1024 (log=0)
    Fragment size=1024 (log=0)
    31360 inodes, 125168 blocks
    6258 blocks (5.00%) reserved for the super user
    First data block=1
    16 block groups
    8192 blocks per group, 8192 fragments per group
    1960 inodes per group
    Superblock backups stored on blocks:
            8193, 24577, 40961, 57345, 73729
    
    Writing inode tables: done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 33 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    #

With the above operations, your CF card has been prepared for use in the OpenBlockS.

  1. To access a drive under Linux, such as to copy files to it, you need to mount it. This is done with the mount(8) command.
    To mount the drive /dev/hda1 by hand, use the command
    # mount /dev/hda1 /mnt
    Your CompactFlash card is now mounted into the file system and can be accessed as the directory /mnt.
  2. To remove the drive from the file system, use the command umount(8).
    Enter the following:
    # umount /dev/hda1
  3. To automatically mount drives at boot time, you need to create an entry for it in the file /etc/fstab. Add the following line to the file:
    /dev/hda1       /mnt            ext2    defaults        1 1
    with the command
    # echo "/dev/hda1   /mnt   ext2   defaults   1 1" >> /etc/fstab
    After that, /etc/fstab should look like this.
    # cat /etc/fstab
    /dev/ram1       /               ext2    defaults        1 1
    none            /proc           proc    defaults        0 0
    /dev/hda1       /mnt            ext2    defaults        1 1
    Note that in a standard installation of the OpenBlockS, SSD/Linux is unpacked from the internal flash ROM into a RAM disk at every boot. When you change a system file like /etc/fstab, you need to update the changes on the Flash ROM or it will be lost at the next boot. This update is done with the flashcfg command.
    # flashcfg -s /etc/flashcfg

Contact and Support

Plat'Home Co., Ltd. support@plathome.com.