wiki:UsersGuide/DisksFileSystems

Version 21 (modified by Jiri Svoboda, 5 years ago) ( diff )

Update for automatic volume mounting, fdisk, vol

Disks and File systems

File system types

HelenOS currently supports the following file systems:

File system /srv executable Can be initrd FS Has mk*fs utility Status
TMPFS tmpfs yes no Stable
FAT fat yes yes Stable
locfs locfs no no Stable
Ext2fs/Ext3fs/Ext4fs ext4fs yes no Stable
exFAT exfat no yes Testing
CDFS cdfs no no Testing
MFS mfs no yes Stable
UDF udf no no Read-only testing

HelenOS also supports the MBR/BIOS and GPT/UEFI partitioning schemes.

Directory structure

The file system of a running HelenOS system is roughly laid out as follows:

/app end-user applications (see the Command Reference)
/cfg system-wide configuration
/data application data (e.g. the web root served by websrv)
/drv device drivers
/inc header files
/lib libraries
/loc location service nodes (rough analogy of /dev in UNIX)
/src source files
/srv server applications (services, e.g. console, networking - see the Command Reference)
/tmp temporary files
/w writable system volume (has free space, can be persistent)

This layout is not fixed in any way and may change in the future.

Block device drivers

Non-DDF:

file_bd File-backed block device
rd Initial ramdisk
sata_bd AHCI SATA
vbd Virtual Block Device - provides block devices for individual partitions

DDF-based:

ata_bd ATA/ATAPI
usbmast USB mass storage
ddisk msim disk driver

Managing disk labels and file systems

You can use the interactive fdisk utility to create and manage disk labels. BIOS/MBR and UEFI/GPT labels are supported. When you create a partition with fdisk, you are also prompted for file system type (The file system will be initialized as part of creating the partition).

If you'd like to create a file system on a raw disk, you need to do it by manually invoking a mk*fs utility.

Here's an example fdisk session where we create a new partition table, create one partition with and Ext4 file system labeled 'Test' that will be automatically mounted at /vol/Test. Note that in several cases we just hit enter and go with the default choice.

/ # fdisk
Select device
1: devices/\hw\sys\00:01.0\ata-c1\d0 (2.097 MB)
2: devices/\hw\sys\00:01.0\ata-c2\d0 (34.09 MB)
3: Exit
Choice> 1
Device: devices/\hw\sys\00:01.0\ata-c1\d0 (2.097 MB)
Disk contains no label.
Entire disk: (No name) 2.097 MB, Empty
Select action
1: Create label
2: Exit
Choice> 1
Select label type
1: MBR [default]
2: GPT
Choice> 1
Device: devices/\hw\sys\00:01.0\ata-c1\d0 (2.097 MB)
Label type: MBR
Maximum free primary block: 2.085 MB
Total free primary space: 2.085 MB
Select action
1: Create primary partition
2: Create extended partition
3: Delete label
4: Exit
Choice> 1
Enter capacity of new partition.
?> 2.085 MB
Select file system type
1: ExFAT
2: FAT
3: MINIX
4: Ext4 [default]
Choice> 4
Enter volume label for new partition.
?> Test
Enter mount point for new partition (Auto, None or /path).
?> Auto
Device: devices/\hw\sys\00:01.0\ata-c1\d0 (2.097 MB)
Label type: MBR
Partition 1: Test 2.085 MB, Primary, Ext4
Select action
1: Modify partition
2: Delete partition
3: Delete label
4: Exit
Choice> 4
/ # vol
Volume Name Resource                            Content  Auto Mounted at     
=========== =================================== ======== ==== ===============
HelenOS-CD  devices/\hw\sys\00:01.0\ata-c2\d0p0 ISO 9660 Yes  /vol/HelenOS-CD
Test        devices/\hw\sys\00:01.0\ata-c1\d0p1 Ext4     Yes  /vol/Test      
/ # 

Accessing File Systems

In many cases the OS makes file systems available automatically. For any file system that has a volume label and is not located on the internal ATA disk drive, it should be automatically available under /vol/<volume_label>. This works for CD-ROMS and USB flash sticks, for example.

To find out which volumes are present in the system and where they are mounted, use the vol command. For example:

/ # vol
Volume Name Resource                            Content  Auto Mounted at     
=========== =================================== ======== ==== ===============
            devices/\hw\sys\00:01.0\ata-c1\d0p0 FAT                          
HelenOS-CD  devices/\hw\sys\00:01.0\ata-c2\d0p0 ISO 9660 Yes  /vol/HelenOS-CD
# 

The partition on the internal drive is not mounted by default, but we can change that using the fdisk command.

If you would like to remove a volume from the system, use the vol eject command:

# vol eject /vol/HelenOS-CD

To insert the volume back we can use either:

# vol insert -p /vol/HelenOS-CD

or

# vol insert devices/\hw\sys\00:01.0\ata-c2\d0p0

Mounting file systems manually

This should only be needed in special circumstances. In most cases use fdisk to configure the mount point. Only do this if you know what you are doing as it may break the system's idea of file system status.

Typing just mount<enter> prints out a list of mounted file systems. The basic syntax to mount a file system is:

# mount <fstype> <directory> <service-name>

fstype is the type of the file system (e.g. fat, ext4, mfs), service-name is the service name of the block device (typically of a partition; it's the long name like devices/\hw\pci...\l0p1) and directory is the directory path to mount on top of.

As service-name is long to type, try cd to /loc and then use tab-completion…

You can find the list of available partition block devices in your system by typing:

# loc show-cat partition

Unlabeled disks will be represented by one 'fake' partition spanning the entire disk.

Note: See TracWiki for help on using the wiki.