I have a strange issue while working with partitions on my Rocky Linux 9 (non LVM) EC2 instance on AWS.
GOAL: I would like to enlarge a little (5GB) my ebs in order to create a new partition and a new xfs filesystem to mount on it /tmp to have it separated from root partition
MY ATTEMPT:
I started to remove from /etc/cloud/cloud.cfg growpart and resizefs to prevent cloud-init to automatically enlarge root partition:
sudo sed -i ‘/ - growpart/d’ /etc/cloud/cloud.cfg
sudo sed -i ‘/ - resizefs/d’ /etc/cloud/cloud.cfg
Then I enlarged my EBS volume from AWS console, from 15GB to 20GB
After that on my ec2 I see, from lsblk ,that the disk has the desired size, so I started my work
I created a new partition with fdisk
I created a filesystem on it: mkfs.xfs -f -L tmp /dev/nvme0n1p5
Until here, every reboot works
I modified /etc/fstab to mount at boot the partition
LABEL=tmp /tmp xfs defaults,noatime,nodev,nosuid,noexec 1 2
then I re-mount (mount -a) to ensure everything works
Tmp is now on my new paritition
Then I reboot my ec2 and the OS is stuck, I cannot connect to it anymore
QUESTIONS:
What is wrong with all of this? What am I missing? tmpfs?
I just need a separated partition, only one this time but can be more in the future, is there a guide to to this on aws?
Maybe try removing the fsck flag. fsck cannot run on xfs. Unless your system has been configured for this flag to trigger xfs_repair, it should just execute fsck.xfs, which does nothing:
System administrator can force fsck.xfs to run xfs_repair(8) at boot time by creating a /forcefsck file or booting the system with “fsck.mode=force” on the kernel command line.
So, fsck.xfs will do nothing at all. Default /etc/fstab settings for / partition - Red Hat Customer Portal
But maybe for some reason it causes the error?
Anyway, is there a reason why you set the dump flag to 1? As far as I know, dump is rarely used these days and incompatible with xfs. To my understanding setting it should have no effect on xfs.
I think I found the issue and the root cause is tmp.mount. In many guide I found online that to mount tmp with an entry in fstab I need to disable that service with
systemctl mask tmp.mount
With this command, that should disable the service, the corresponding unit is redirect to null, via symbolic link I suppose