Have a Question?
< All Topics

Create XFS File System on Debian 10

Tutorial on how to create XFS file system on Debian 10

xfs which is the default file system in Red Hat Enterprise Linux 8, is a highly scalable, high-performance, robust, and mature 64-bit journaling file system that supports very large files and file systems on a single host.

xfs file system is required to support Fast Clone which is the Veeam Backup & Replication technology that helps create quick file copies. Fast Clone increases the speed of synthetic backup creation and transformation, reduces disk space requirements, and decreases the load on storage devices.

Install & Load xfs Kernel Module

Install xfs

$ apt update
$ sudo apt-get install xfsprogs

Load xfs kernel module

$ sudo modprobe -v xfs
    insmod /lib/modules/4.19.0-9-amd64/kernel/lib/libcrc32c.ko 
    insmod /lib/modules/4.19.0-9-amd64/kernel/fs/xfs/xfs.ko

Verify xfs module is loaded successfully

$ sudo lsmod | grep xfs
xfs                  1462272  0
libcrc32c              16384  1 xfs

$ sudo modinfo xfs
filename:       /lib/modules/4.19.0-14-amd64/kernel/fs/xfs/xfs.ko
license:        GPL
description:    SGI XFS with ACLs, security attributes, realtime, no debug enabled
author:         Silicon Graphics, Inc.
alias:          fs-xfs
depends:        libcrc32c
retpoline:      Y
intree:         Y
name:           xfs
vermagic:       4.19.0-14-amd64 SMP mod_unload modversions
sig_id:         PKCS#7
signer:         Debian Secure Boot CA
sig_key:        B5:5E:B3:B9
sig_hashalgo:   sha256
signature:      35:24:AD:A2:90:B9:63:E5:E6:9C:4D:09:84:57:8E:24:C1:19:E5:05:

Add new Disk with xfs filesystem

Add a new 500GB Hard Disk from VMware, and verify the new hard disk – /dev/sdb is visible in Debian

$ sudo fdisk -l
[sudo] password for kwyong:
Disk /dev/sda: 16 GiB, 17179869184 bytes, 33554432 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8716496a

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1  *        2048 25165823 25163776  12G 83 Linux
/dev/sda2       25167870 33552383  8384514   4G  5 Extended
/dev/sda5       25167872 33552383  8384512   4G 82 Linux swap / Solaris

Disk /dev/sdb: 500 GiB, 536870912000 bytes, 1048576000 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Create xfs filesystem on /dev/sdb to be used in Veeam Linux Repository to support xfs Fast Clone

  • size=4096 sets file system block size to 4096 bytes,
  • reflink=1 enables reflinking for the XFS instance (disabled by default),
  • crc=1 enables checksums, required for reflink=1 (enabled by default).
$ sudo mkfs.xfs -b size=4096 -m reflink=1,crc=1 /dev/sdb
meta-data=/dev/sdb               isize=512    agcount=4, agsize=32768000 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=131072000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=64000, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Mount /dev/sdb to /XFS

$ sudo mkdir /XFS
$ sudo mount /dev/sdb /XFS
$ df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  983M     0  983M   0% /dev
tmpfs          tmpfs     200M  5.6M  194M   3% /run
/dev/sda1      ext4       15G  1.4G   13G  10% /
tmpfs          tmpfs     998M     0  998M   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs     998M     0  998M   0% /sys/fs/cgroup
/dev/sdb       xfs       500G  1.7G   29G   6% /XFS
tmpfs          tmpfs     200M     0  200M   0% /run/user/1000

Auto Mount During System Reboot

Verify the UUID of /dev/sdb

$ sudo blkid
/dev/sda1: UUID="9cff15b4-ebf4-44c9-bb53-e8b3bf394b5a" TYPE="ext4" PARTUUID="fcf2e205-01"
/dev/sda5: UUID="bdabd87f-46e8-4262-a9b0-240d62b7e30f" TYPE="swap" PARTUUID="fcf2e205-05"
/dev/sdb: UUID="9ce07cdc-9c0c-4fab-8567-f9661930e099" TYPE="xfs"

Update /dev/fstab to mount /XFS during system reboot

$ sudo echo 'UUID=9ce07cdc-9c0c-4fab-8567-f9661930e099 /data xfs defaults 1 1' >> /etc/fstab

Reboot and verify /XFS is mounted automatically when server is up.

Table of Contents
Scroll to Top