GNU/Linux File Systems

By admin, 28 April, 2025

Initramfs: in computing, initrd is a scheme for loading a temporary root file system into memory, which may be used as part of the Linux startup process. The key parts of initramfs are:

  • The special file /dev/initrd is a read-only block device. This device is a RAM disk that is initialized (e.g., loaded) by the boot loader before the kernel is started.
  • CPIO archive, so no filesystems at all are needed in kernel. The archive is simply unpacked into a ram disk.
  • This unpacking happens before do_basic_setup is called. This means that firmware files are available before in-kernel drivers load.
  • The userspace init is called instead of prepare_namespace. All finding of the root device, and md setup happens in userspace.
  • An initramfs can be built into the kernel directly by adding it to the ELF archive under the section name .init.ramfs
  • initramfs' can be stacked. Providing an initramfs to the kernel using the traditional initrd mechanisms causes it to be unpacked along side the initramfs' that are built into the kernel.
  • All magic naming of the root device goes away. Integrating udev into the initramfs means that the exact same view of the /dev tree can be used throughout the boot sequence. This should solve the majority of the SATA failures that are seen where an install can succeed, but the initrd cannot boot.

Swap space: when physical memory (RAM) is out of space then swap area can take care of it. In case of failure at boot:

  • sudo blkid
  • copy the swap UUID
  • sudo nano /etc/initramfs-tools/conf.d/resume
  • sudo mkswap -U custom_uuid /dev/sdx

EXT2,3,4: the extended file system was implemented as the first file system created specifically for the Linux kernel. It has metadata structure inspired by the traditional Unix File System.

  • Type or version 2 is suitable for boot volumes
  • Type or version 2 isn't a journaling file system

LVM2: Logical Volume Manager is a device mapper target that provides logical volume management for the Linux kernel.

  • pvchange - Change attributes of a Physical Volume.
  • pvck - Check Physical Volume metadata.
  • pvcreate - Initialize a disk or partition for use by LVM.
  • pvdisplay - Display attributes of a Physical Volume.
  • pvmove - Move Physical Extents.
  • pvremove - Remove a Physical Volume.
  • pvresize - Resize a disk or partition in use by LVM2.
  • pvs - Report information about Physical Volumes.
  • pvscan - Scan all disks for Physical Volumes.
  • vgcfgbackup - Backup Volume Group descriptor area.
  • vgcfgrestore - Restore Volume Group descriptor area.
  • vgchange - Change attributes of a Volume Group.
  • vgck - Check Volume Group metadata.
  • vgconvert - Convert Volume Group metadata format.
  • vgcreate - Create a Volume Group.
  • vgdisplay - Display attributes of Volume Groups.
  • vgexport - Make volume Groups unknown to the system.
  • vgextend - Add Physical Volumes to a Volume Group.
  • vgimport - Make exported Volume Groups known to the system.
  • vgimportclone - Import and rename duplicated Volume Group (e.g. a hardware snapshot).
  • vgmerge - Merge two Volume Groups.
  • vgmknodes - Recreate Volume Group directory and Logical Volume special files.
  • vgreduce - Reduce a Volume Group by removing one or more Physical Volumes.
  • vgremove - Remove a Volume Group.
  • vgrename - Rename a Volume Group.
  • vgs - Report information about Volume Groups.
  • vgscan - Scan all disks for Volume Groups and rebuild caches.
  • vgsplit - Split a Volume Group into two, moving any logical volumes from one Volume Group to another by moving entire Physical Volumes.
  • lvchange - Change attributes of a Logical Volume.
  • lvconvert - Convert a Logical Volume from linear to mirror or snapshot.
  • lvcreate - Create a Logical Volume in an existing Volume Group.
  • lvdisplay - Display attributes of a Logical Volume.
  • lvextend - Extend the size of a Logical Volume.
  • lvmchange - Change attributes of the Logical Volume Manager.
  • lvmdiskscan - Scan for all devices visible to LVM2.
  • lvmdump - Create lvm2 information dumps for diagnostic purposes.
  • lvreduce - Reduce the size of a Logical Volume.
  • lvremove - Remove a Logical Volume.
  • lvrename - Rename a Logical Volume.
  • lvresize - Resize a Logical Volume.
  • lvs - Report information about Logical Volumes.
  • lvscan - Scan (all disks) for Logical Volumes.