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). |
| 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), tab completion and [wiki:TextEditing clipboard integration] (Shift + Left and Shift + Right keys to select, Ctrl + C and Ctrl + V to copy and paste). |
| 129 | |
| 130 | == Advanced: File systems == |
| 131 | |
| 132 | HelenOS 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 | {{{ |
| 135 | dd if=/dev/zero of=disk.img bs=4096 count=1024 |
| 136 | }}} |
| 137 | |
| 138 | Then 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 |
| 142 | bd: |
| 143 | devices/\hw\pci0\00:01.0\ata-c1\d0 : devman |
| 144 | devices/\hw\pci0\00:01.0\ata-c2\d0 : devman |
| 145 | }}} |
| 146 | |
| 147 | The 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 |
| 151 | Device: devices/\hw\pci0\00:01.0\ata-c1\d0 |
| 152 | mkfat: Block device has 8192 blocks. |
| 153 | mkfat: Creating FAT12 filesystem on device devices/\hw\pci0\00:01.0\ata-c1\d0. |
| 154 | Writing allocation table 1. |
| 155 | Writing allocation table 2. |
| 156 | Writing root directory. |
| 157 | Success. |
| 158 | / # mkdir /mnt |
| 159 | / # fat |
| 160 | fat: HelenOS FAT file system server |
| 161 | fat: 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 | |
| 167 | HelenOS 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 | |
| 169 | You 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 |
| 174 | file_bd: File-backed block device driver |
| 175 | file_bd: Accepting connections |
| 176 | / # mkfat --type 12 bd/loop0 |
| 177 | Device: bd/loop0 |
| 178 | mkfat: Block device has 200 blocks. |
| 179 | mkfat: Creating FAT12 filesystem on device bd/loop0. |
| 180 | Writing allocation table 1. |
| 181 | Writing allocation table 2. |
| 182 | Writing root directory. |
| 183 | Success. |
| 184 | / # mkdir /mnt |
| 185 | / # fat |
| 186 | fat: HelenOS FAT file system server |
| 187 | fat: Accepting connections |
| 188 | / # mount fat /mnt bd/loop0 |
| 189 | / # cp demo.txt /mnt/ |
| 190 | / # umount /mnt |
| 191 | }}} |