• Skip to main content

Uly.me

cloud engineer

  • Home
  • Archives
  • Search

xfs

Resizing XFS root partition in GCP

July 16, 2021 by Ulysses

How to resize a root partition in GCP.

Increase disk size.

gcloud compute disks resize server-boot-disk-name \
--size=50GB \
--zone us-central1-c \
--project your-project-id

gcloud compute disks resize server-boot-disk-name \ --size=50GB \ --zone us-central1-c \ --project your-project-id

Run growpart.

growpart /dev/sda 1

growpart /dev/sda 1

Run xfs_growfs.

xfs_growfs /dev/sda1

xfs_growfs /dev/sda1

To verify, run these.

lsblk
df -Th

lsblk df -Th

Filed Under: Cloud, Linux Tagged With: boot, extend, gcp, growpart, root, xfs, xfs_growfs

AWS XFS Volume Setup

March 31, 2020 by Ulysses

Here’s how to setup a XFS volume.

file -s /dev/nvme2n1
mkfs -t xfs /dev/nvme2n1

file -s /dev/nvme2n1 mkfs -t xfs /dev/nvme2n1

Mount to /data.

mkdir /data
mount /dev/nvme2n1 /data

mkdir /data mount /dev/nvme2n1 /data

Add to /etc/fstab.

vim /etc/fstab
#
#
UUID=xxxxxxxxxxxxxxxxxxxxxx /data  xfs  defaults 0 0

vim /etc/fstab # # UUID=xxxxxxxxxxxxxxxxxxxxxx /data xfs defaults 0 0

Filed Under: Cloud, Linux Tagged With: aws, fstab, mount, nvme, volumes, xfs

Create Swap Disk

March 28, 2020 by Ulysses

To see which disk is available for swap disk use.

lsblk
blkid
df -Th

lsblk blkid df -Th

Format the disk.

fdisk /dev/xvda

fdisk /dev/xvda

Create a swap disk.

sudo mkswap -f /dev/xvda
sudo swapon -s /dev/xvda
# or
sudo swapon /dev/xvda

sudo mkswap -f /dev/xvda sudo swapon -s /dev/xvda # or sudo swapon /dev/xvda

Check if swap disk is available.

lsblk
free -h 
cat /proc/swaps
cat /proc/meminfo
swapon -s
top
vmstat
vmstat 1 5

lsblk free -h cat /proc/swaps cat /proc/meminfo swapon -s top vmstat vmstat 1 5

Filed Under: Linux Tagged With: create, redhat, swap, xfs

XFS Filesystem has duplicate UUID

October 7, 2019 by Ulysses

Here’s how to fix a duplicate UUID on a XFS file system.

mount -o rw,nouuid /dev/sda1  /data

mount -o rw,nouuid /dev/sda1 /data

Mounting with nouuid will work, but not after a reboot.

To avoid a duplicate ID, run this command to generate a new UUID.

xfs_admin -U generate /dev/sda3
Clearing log and setting UUID
writing all SBs
new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

xfs_admin -U generate /dev/sda3 Clearing log and setting UUID writing all SBs new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

Filed Under: Linux Tagged With: duplicate, generate, mount, uuid, xfs

XFS vs Ext4 Commands

April 30, 2019 by Ulysses

File system command differences between ext3 and xfs.

Taskext4xfs
Creating a file systemmkfs.ext4mkfs.xfs
Mounting a file systemmountmount
Resizing a file systemresize2fsxfs_growfs
Repairing a file systeme2fsckxfs_repair
Changing the label on a file systeme2labelxfs_admin -L
Reporting on disk space and file usagequota quota
Debugging a file systemdebugfsxfs_db
Saving critical file system metadata to a filee2imagexfs_metadump

Filed Under: Linux Tagged With: ext4, file system, xfs

Adding a XFS Volume

March 7, 2019 by Ulysses

Add a disk volume via cloud console. Then perform the following commands:

# check the new block
lsblk
# format
fdisk /dev/sdc
# create file system
mkfs.xfs -f /dev/sdc1
# get uuid
blkid /dev/sdc1
# vi /etc/fstab
UUID="xxxxxxxxxxxxxxxxxxxxx" /mnt/directory xfs defaults 0 0
# mount
mount -a

# check the new block lsblk # format fdisk /dev/sdc # create file system mkfs.xfs -f /dev/sdc1 # get uuid blkid /dev/sdc1 # vi /etc/fstab UUID="xxxxxxxxxxxxxxxxxxxxx" /mnt/directory xfs defaults 0 0 # mount mount -a

Filed Under: Linux Tagged With: add, fstab, mount, xfs

xfs vs ext 2/3/4

January 29, 2019 by Ulysses

When resizing disks, here are the commands for each respected file system.

For xfs:

xfs_growfs /dev/vgname/lgname

xfs_growfs /dev/vgname/lgname

For ext 2/3/4:

resize2fs /dev/vgname/lgname

resize2fs /dev/vgname/lgname

Filed Under: Linux Tagged With: efs, xfs

  • Home
  • About
  • Contact

Copyright © 2022