Filesystems: Difference between revisions
Prabuanand (talk | contribs) (added dmcrypt info from https://www.nico.schottelius.org/blog/2024-10-10-how-to-enable-encrypted-swap-in-alpine-linux/) |
Prabuanand (talk | contribs) (moved Formatting partitions to Setting_up_disks_manually page) |
||
(One intermediate revision by the same user not shown) | |||
Line 42: | Line 42: | ||
| | | | ||
|} | |} | ||
== Swap Partition == | == Swap Partition == | ||
Line 72: | Line 51: | ||
Below Instructions explain how to use a seperate partition for swap: | 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: | |||
# mkswap /dev/sda2 | # mkswap /dev/sda2 | ||
# swapon /dev/sda2 | # swapon /dev/sda2 | ||
# rc-service swap start | |||
The command {{Codeline|free -m}} will show how much swap space is available (in MB). | |||
To make the swap persistent across reboots, enable automatic start of swap: | To make the swap persistent across reboots, enable automatic start of swap: | ||
# echo -e "/dev/sda2 none swap sw 0 0" >> /mnt/etc/fstab | # echo -e "/dev/sda2 none swap sw 0 0" >> /mnt/etc/fstab | ||
# rc- | # rc-update add swap | ||
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. | 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. |
Latest revision as of 05:18, 6 November 2024
Alpine Linux supports a number of filesystems.
Filesystem Tools
Alpine has multiple storage media formatting packages available. Different packages/programs are used to format different types of filesystems.
Tool | Filesystem | Brief Notes |
---|---|---|
btrfs-progs | Btrfs | |
dosfstools | FAT12/FAT16/FAT32 | |
e2fsprogs | ext2/ext3/ext4 | ext4 is current default |
f2fs-tools | F2FS | |
hfsprogs | XFS HFS/HFS+ | Apple/Mac products |
jfsutils | JFS | |
ntfs-3g | NTFS | Microsoft/Windows FUSE driver |
xfsprogs | XFS |
Swap Partition
Swap space is used for two purposes
- Extend the virtual memory beyond the installed physical memory (RAM) to avoid 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:
# mkswap /dev/sda2 # swapon /dev/sda2 # rc-service swap start
The command free -m will show how much swap space is available (in MB).
To make the swap persistent across reboots, enable automatic start of swap:
# echo -e "/dev/sda2 none swap sw 0 0" >> /mnt/etc/fstab # rc-update add swap
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.
Encrypted swap
The below steps explains the steps to enable crypt-swap or Encrypted swap parition.
Edit the file /etc/conf.d/dmcrypt to enable crypt-swap. Ensure that source device name is correct. :
Contents of /etc/conf.d/dmcrypt
To use dmcrypt, start dmcrypt service and enable swap immediately:
# /etc/init.d/dmcrypt start # swapon /dev/mapper/crypt-swap
To make the encrypted swap persistent across reboots, enable automatic start of encryption & swap:
# rc-update add dmcrypt # rc-update add swap
To enable automatic swapon, add the relevant entry to /etc/fstab
# echo /dev/mapper/crypt-swap swap swap defaults 0 0 >> /etc/fstab