Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changes between Version 6 and Version 7 of Tutorial


Ignore:
Timestamp:
2014-12-18T18:26:50Z (4 years ago)
Author:
Martin Decky
Comment:

file systems

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial

    v6 v7  
    4848Once you get bored by this, just run `tetris` from the terminal window. This should make you occupied for some time.
    4949
    50 The shell supports some basic commands you are likely familiar with: `ls`, `cat`, `cd`, `pwd`, `cp`, `mv`, `rm`, `mkdir`, `echo`, etc. If you get totally lost, just run the `help` command to give you some hints. You can use `help commands` to list the internal commands of the shell and `help help` to get more information on how the help system works. The shell provides commands history (Up and Down keys) and [wiki:TextEditing clipboard integration] (Shift + Left and Shift + Right keys to select, Ctrl + C and Ctrl + V to copy and paste).
     50The shell supports some basic commands you are likely familiar with: `ls`, `cat`, `cd`, `pwd`, `cp`, `mv`, `rm`, `mkdir`, `echo`, etc. If you get totally lost, just run the `help` command to give you some hints. You can use `help commands` to list the internal commands of the shell and `help help` to get more information on how the help system works. The shell provides commands history (Up and Down keys), tab completion and [wiki:TextEditing clipboard integration] (Shift + Left and Shift + Right keys to select, Ctrl + C and Ctrl + V to copy and paste).
    5151
    5252There is also support for different keyboard layouts. You can switch between three sample layouts using:
     
    127127* `redir`
    128128  - Redirect the standard/error output of a task to a file for later examination.
     129
     130== Advanced: File systems ==
     131
     132HelenOS provides means to access other file systems than the root file system. To test this functionality in a completely safe way, you can create an empty disk image in your host system. For example in GNU/Linux:
     133
     134{{{
     135dd if=/dev/zero of=disk.img bs=4096 count=1024
     136}}}
     137
     138Then run QEMU as usual, but add the `-hda disk.img` command line argument. Now you should be able to ask the location service in HelenOS for the block device name:
     139
     140{{{
     141/ # loc show-cat bd
     142bd:
     143        devices/\hw\pci0\00:01.0\ata-c1\d0 : devman
     144        devices/\hw\pci0\00:01.0\ata-c2\d0 : devman
     145}}}
     146
     147The first device is your disk image attached to PATA primary master port (the second image is the PATA secondary master port with the live CD that was used to boot HelenOS from). The following listing shows how to create a FAT file system on the disk device, run the FAT file system driver, mount the file system, store a file on it and unmount the file system. If you then examine the disk image in your host system, you will see the file stored on the file system.
     148
     149{{{
     150/ # mkfat --type 12 devices/\hw\pci0\00:01.0\ata-c1\d0
     151Device: devices/\hw\pci0\00:01.0\ata-c1\d0
     152mkfat: Block device has 8192 blocks.
     153mkfat: Creating FAT12 filesystem on device devices/\hw\pci0\00:01.0\ata-c1\d0.
     154Writing allocation table 1.
     155Writing allocation table 2.
     156Writing root directory.
     157Success.
     158/ # mkdir /mnt
     159/ # fat
     160fat: HelenOS FAT file system server
     161fat: Accepting connections
     162/ # mount fat /mnt devices/\hw\pci0\00:01.0\ata-c1\d0
     163/ # cp demo.txt /mnt/
     164/ # umount /mnt
     165}}}
     166
     167HelenOS supports [wiki:UsersGuide/DisksFileSystems more file system types] than just FAT. Just remember to run the appropriate file system driver first. If your disk image contains an MBR or GUID partition table, use the `mbr_part` and `g_part` drivers to create individual partition device nodes to access.
     168
     169You can also create a disk image in a file on the file system already mounted in HelenOS, create a loopback device from it and mount that image:
     170
     171{{{
     172/ # mkfile --size 102400 disk.img
     173/ # file_bd disk.img bd/loop0
     174file_bd: File-backed block device driver
     175file_bd: Accepting connections
     176/ # mkfat --type 12 bd/loop0
     177Device: bd/loop0
     178mkfat: Block device has 200 blocks.
     179mkfat: Creating FAT12 filesystem on device bd/loop0.
     180Writing allocation table 1.
     181Writing allocation table 2.
     182Writing root directory.
     183Success.
     184/ # mkdir /mnt
     185/ # fat
     186fat: HelenOS FAT file system server
     187fat: Accepting connections
     188/ # mount fat /mnt bd/loop0
     189/ # cp demo.txt /mnt/
     190/ # umount /mnt
     191}}}