Have a Question?
< All Topics
Print

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:
                9F:FC:0A:36:F9:0E:E6:D0:E9:1A:E7:E7:C3:9E:AE:11:6B:FF:5D:13:
                3A:6D:C6:6A:DA:A3:64:AB:6C:53:F1:14:59:F4:63:37:87:84:8A:50:
                B5:DD:0C:72:CF:AD:E5:85:61:94:41:40:35:0D:DA:40:96:C5:82:63:
                DB:10:87:95:A7:DB:F7:04:DE:FA:42:C3:7F:0F:D6:ED:11:AB:F0:12:
                D6:F4:F7:83:F5:30:FC:F6:B2:D6:96:2E:CF:D7:BB:59:0C:14:4B:3F:
                D0:B9:8E:26:94:11:37:05:4B:A8:95:6C:96:1D:7D:72:0C:EB:E2:5E:
                65:71:02:3E:52:2F:CE:F2:D9:49:C5:E4:DD:E5:95:FD:C9:00:75:C8:
                96:24:1D:54:54:B5:C2:5F:3B:73:FD:9F:B4:F6:CD:94:DB:92:F5:45:
                36:95:3A:C9:5F:A8:00:16:C9:9B:CE:97:2D:6D:B9:F4:03:56:B5:DC:
                E2:14:14:CF:AF:7B:C6:66:7E:0A:3E:A2:1D:D1:D7:4B:CE:2C:E3:9B:
                06:03:7F:DB:E4:17:C4:35:76:59:3C:1D:97:18:19:50:A3:46:AD:D5:
                6E:59:86:59:8F:5B:0D:F6:89:43:C3:11:36:6B:E7:15

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