Filesystems: Difference between revisions

From Alpine Linux
(updated table properties, changed btrfs description, added entry for squashfs)
(moved Swap related content to its own page)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Alpine Linux supports all the popular filesystems for various storage media. Different packages/programs are used to format different types of filesystems.
This page documents the Alpine Linux supported filesystems needed for various storage media.  


== Filesystem tools ==
== Overview ==


The following table lists the packages related to various filesystems available in Alpine Linux along with the '''command''' to format.
The following table lists the packages related to various filesystems available in Alpine Linux along with the '''command''' to format.
Line 33: Line 33:
|}</onlyinclude>
|}</onlyinclude>


== Swap partition ==
== Filesystem tools ==
 
Swap space is used for two purposes
# Extend the virtual memory beyond the installed physical memory (RAM) to avoid [https://en.wikipedia.org/wiki/Out_of_memory Out of memory] condition 
# Suspend-to-disk or Hibernation support
 
Below Instructions explain how to use a seperate partition for swap:
 
The following commands prepares the unmounted partition (/dev/sda2) for swap space, activates the prepared swap space and starts the swap service to manage swap space immediately:{{Cmd|<nowiki># mkswap /dev/sda2
# swapon /dev/sda2
# rc-service swap start</nowiki>}}
 
The command {{ic|free -m}} will show how much swap space is available (in MB).
 
To make the swap persistent across reboots, enable automatic start of swap:{{Cmd|<nowiki># echo -e "/dev/sda2 none swap defaults 0 0" >> /etc/fstab
# rc-update add swap </nowiki>}}
 
Instead of device name <code>/dev/sda2</code>, the <code>UUID=device_UUID</code> can also be used in {{Path|etc/fstab}} file, if '''UUID''' is being used for other partitions.
 
If you prefer maximum speed, you don't need configure any raid devices for swap. Just add 2 swap partitions on different disks and linux will stripe them automatically. The downside is that the moment one disk fails, the system will go down. For better reliability, put swap on RAID1.
{{Tip|Instead of using a separate partition for swap, [[Zram|zram]] based swap file can be used.}}
 
== Encrypted swap ==
 
The below steps explains the steps to enable crypt-swap or Encrypted swap parition.
 
Edit the file {{Path|/etc/conf.d/dmcrypt}} to enable crypt-swap and ensure that source device name is correct: {{Cat|/etc/conf.d/dmcrypt|
swap{{=}}crypt-swap
source{{=}}'/dev/nvme0nXXX'}}
 
To use dmcrypt, start dmcrypt service and enable swap immediately:{{Cmd|<nowiki># /etc/init.d/dmcrypt start
# swapon /dev/mapper/crypt-swap </nowiki>}}
 
To make the encrypted swap persistent across reboots, enable automatic start of encryption & swap:{{Cmd|<nowiki># rc-update add dmcrypt
# rc-update add swap </nowiki>}}
 
To enable automatic swapon, add the relevant entry to {{Path|/etc/fstab}}: {{Cmd|# echo /dev/mapper/crypt-swap none swap defaults 0 0 >> /etc/fstab}}


{{Note|The above instructions will reset/re-encrypt swap on every boot and thus no suspend to disk works with it.}}
Different packages/programs are used to format different types of filesystems. The filesystem tools and the formatting commands are listed [[#Overview|above]].


== See also ==
== See also ==
* [[Zram]]
* [[Setting_up_disks_manually#Manual_partitioning|Manual partitioning]]
* [[Setting_up_disks_manually#Manual_partitioning|Manual partitioning]]
* [https://www.nico.schottelius.org/blog/2024-10-10-how-to-enable-encrypted-swap-in-alpine-linux/ How to enable encrypted swap in Alpine Linux]
* [https://www.nico.schottelius.org/blog/2024-10-10-how-to-enable-encrypted-swap-in-alpine-linux/ How to enable encrypted swap in Alpine Linux]

Latest revision as of 06:28, 2 April 2025

This page documents the Alpine Linux supported filesystems needed for various storage media.

Overview

The following table lists the packages related to various filesystems available in Alpine Linux along with the command to format.

Tool Filesystem Formatting command Brief Notes
btrfs-progs Btrfs mkfs.btrfs combines copy-on-write and volume management
dosfstools FAT12/FAT16/FAT32 mkfs.vfat also used for EFI partition
e2fsprogs ext2/ext3/ext4 mkfs.ext4 ext4 is current default in Linux
exfatprogs exfat mkfs.exfat Commonly used on USB flash drives and SD cards
f2fs-tools F2FS mkfs.f2fs
hfsprogs HFS/HFS+ mkfs.hfsplus Apple/Mac products
jfsutils JFS mkfs.jfs
ntfs-3g NTFS mkfs.ntfs Full-featured, Microsoft/Windows FUSE driver
squashfs-tools SquashFS mksquashfs compressed read-only file system
xfsprogs XFS mkfs.xfs

Filesystem tools

Different packages/programs are used to format different types of filesystems. The filesystem tools and the formatting commands are listed above.

See also