I tried to add swapfile to the root file system on AWS EC2 instance. Did I made a mistake during the edit of fstab?
sudo dd if=/dev/zero of=/swapfile bs=1G count=4
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
I have edited /etc/fstab
vi /etc/fstab
/swapfile swap swap defaults 0 0
Swap worked fine but after reboot, a system doesn't work. I have decided to attach device to another instance and remove a line in fstab, but it can't be mounted on another instance.
mount: wrong fs type, bad option, bad superblock on /dev/xvdf,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
How can I edit fstab and remove a line with swap data on unmounted device?
lsblk -f
output
NAME FSTYPE LABEL UUID MOUNTPOINT
xvda
`-xvda1 ext4 cloudimg-rootfs 7b2XXX-16d3-XXXX-b32e-1857XXXXXXXX /
xvdf
`-xvdf1