Tag: xfs

  • XFS quota not working RAID 1

    XFS quota not working RAID 1

    On a cPanel server with RAID 1, the quota was disabled on the / file system even after it was enabled in /etc/fstab

    [root@server48 ~]# mount | grep "/ "
    /dev/md3 on / type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
    [root@server48 ~]# 
    

    It says noquota.

    xfs_quota -x -c 'report -h'
    

    Returned empty result.

    In /etc/fstab, the quota was enabled properly

    UUID=30c3c244-1e7c-4cc5-babd-d6cf8eee8ac5 / xfs defaults,uquota,usrquota 0 1
    

    /etc/default/grub has the following GRUB_CMDLINE_LINUX line

    GRUB_CMDLINE_LINUX="crashkernel=auto rd.auto nomodeset rootflags=uquota"
    

    The problem was caused due to grub.cfg read from the wrong drive.

    [root@server48 ~]#  grep boot /etc/fstab
    UUID=f2edd8de-2161-482b-b27f-9d399eed1abe	/boot	xfs	defaults	0	0
    /dev/nvme1n1p1       /boot/efi       vfat    defaults        0       1
    [root@server48 ~]# 
    

    The server is using EFI and /dev/nvme1n1p1 is mounted as /boot/efi, Since we are using RAID 1, we have 2 EFI partitions

    [root@server48 ~]# blkid | grep EFI
    /dev/nvme0n1p1: SEC_TYPE="msdos" LABEL="EFI_SYSPART" UUID="6B1C-67AC" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="primary" PARTUUID="a26b50cd-357f-4a93-b0c7-41f89bd4e038"
    /dev/nvme1n1p1: SEC_TYPE="msdos" LABEL="EFI_SYSPART" UUID="6B59-E668" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="primary" PARTUUID="b24738fb-f7fd-4354-a35a-af9f3fac9b77"
    [root@server48 ~]# 
    

    In /etc/fstab, we are using /dev/nvme1n1p1, when server is booting, it is using the other EFI partition.

    The Solution

    Update grub on the other EFI partition. Update /etc/fstab to use the partition as /boot/efi

    mount /dev/nvme0n1p1 /mnt/
    

    Regenerate grub.cfg in the 2nd EFI partition that is mounted as /mnt/

    cp /mnt/EFI/almalinux/grub.cfg{,.backup}
    grub2-mkconfig -o /mnt/EFI/almalinux/grub.cfg
    

    Edit /etc/fstab

    vi /etc/fstab
    

    Find

    /dev/nvme1n1p1       /boot/efi       vfat    defaults        0       1
    

    Replace with

    /dev/nvme0n1p1       /boot/efi       vfat    defaults        0       1
    

    Reboot the server

    reboot
    

    After reboot, the mount command shows quota enabled for / partition.

    xfs filesystem quota on raid1

    Back to quota

  • Failed to mount /sysroot XFS Boot failure

    Failed to mount /sysroot XFS Boot failure

    On an Amazon EC2 server, the server won’t boot. On checking the serial console, the server was stuck with an error message

    [FAILED] Failed to mount /sysroot
    See 'systemctl status sysroot.mount' for details.
    

    Failed to mount /sysroot

    I created a new EC2 instance in the same region as the current server, detached the disk, and attached it to the new EC2 instance. When I try to mount the disk, it just hangs and i have to reboot the EC2 instance.

    Used parted -l command to see the disk details.

    parted command

    The disk file system is XFS. Checked the disk with the command

    xfs_repair -v DEVICE_NAME_HERE
    

    In this case DEVICE_NAME is /dev/nvme1n1p1.

    xfs_repair command

    The disk has errors. Fixed it by running the command

    xfs_repair -v -L /dev/nvme1n1p1
    

    See HDD

  • xfs

    xfs is default file system for RHEL 7.

    To format a partition in xfs format, run

    mkfs.xfs /dev/sdXX
    

    Example

    [root@ssd ~]# mkfs.xfs /dev/sdc1
    meta-data=/dev/sdc1              isize=512    agcount=6, agsize=268435455 blks
             =                       sectsz=4096  attr=2, projid32bit=1
             =                       crc=1        finobt=0, sparse=0
    data     =                       bsize=4096   blocks=1464843520, imaxpct=5
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
    log      =internal log           bsize=4096   blocks=521728, version=2
             =                       sectsz=4096  sunit=1 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    [root@ssd ~]# 

    Failed to mount /sysroot XFS Boot failure
    fs