User Tools

Site Tools


Summary

These instructions explain how to make a file system on a partition. It can either be a newly installed mSATA SSD or an inserted USB drive.

Instructions

If you have just made a new partition on a disk you will know that it has no filesystem and you can make one without loosing data. If in doubt you can try to mount it first. If mount gives an error you are (almost) safe to make a filesystem on it. To list all partitions on the system run the command ls -l /dev/sd??*. In this example there is only one called sda1:

root@turris:~# ls -l /dev/sd??*
brw-r--r--    1 root     root        8,   1 Nov 27 20:50 /dev/sda1

Try to mount the partition and get an error to make sure it has no data with mount /dev/sda1 /mnt:

root@turris:~# mount /dev/sda1 /mnt
mount: you must specify the filesystem type

We are now safe to make a filesystem on the partition.

There are several filesystem to chose. For a SSD drive Butter fuss btrfs might be the right choice and for an USB drive vfat might be the right. Here we make a filesystem for btrfs with the command mkfs.btrfs /dev/sda1:

root@turris:~# mkfs.btrfs /dev/sda1
btrfs-progs v4.17.1 
See http://btrfs.wiki.kernel.org for more information.

Detected a SSD, turning off metadata duplication.  Mkfs with -m dup if you want to force metadata duplication.
Performing full device TRIM /dev/sda1 (223.57GiB) ...
Label:              (null)
UUID:               c3ed7dcb-49c0-4e49-8d90-df42074e8aa3
Node size:          16384
Sector size:        4096
Filesystem size:    223.57GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         single            8.00MiB
  System:           single            4.00MiB
SSD detected:       yes
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1   223.57GiB  /dev/sda1

Now the sda1 partition is formatted and ready to be mounted.

To get a list of all filesystem commands type mkfs. and press the tabulator key twice:

root@turris:~# mkfs.
mkfs.btrfs    mkfs.ext2     mkfs.ext3     mkfs.ext4     mkfs.fat      mkfs.hfs
mkfs.hfsplus  mkfs.msdos    mkfs.vfat     mkfs.xfs