skip to Main Content

How can I check /dev/xvda1?

You can check or run fsck on /dev/xvda1 using the following method on Ubuntu or Debian Linux based cloud server. The fsck command is used check and repair a Linux filesystem

Step 1 – Force fsck

Type the following command to force fsck on reboot:
$ sudo touch /forcefsck

Step 2 – Configure fsck during boot

You must do automatic repair filesystems with inconsistencies during boot. Run command:
$ sudo vi /etc/default/rcS
$ sudo nano /etc/default/rcS
Make sure FSCKFIX set to yes:
Save and close the file.

Step 3 – Edit /etc/fstab file

Type the following command:
$ sudo vi /etc/fstab
$ sudo nano /etc/fstab
Find out the record for / or /boot/ and if the last digit is ‘0’ change it to ‘1’. For example:

LABEL=cloudimg-rootfs   /        ext4   defaults,relatime       0 0

Change to 1:

LABEL=cloudimg-rootfs   /        ext4   defaults,relatime       0 1

Save and close the file. The last field is used by fsck command to determine the order in which filesystem checks are done at boot time. The root (/) filesystem should be specified with avalue of 1. Other filesystems should have a value of 2.

Step 4 – Reboot the system

Type the following command to reboot the Linux server/desktop:
$ sudo reboot
This will run fsck on reboot and fix any problem too.

Step 5 – Revert changes

Once booted, you can change value from ‘1’ to ‘0’ in /etc/fstab file using a text editor such as vi or nano. Make sure you set the line FSCKFIX to no (FSCKFIX=no) in /etc/default/rcS file too. Verify updated setting with grep command:
grep 'FSCKFIX' /etc/default/rcS

$ grep 'LABEL=cloudimg-rootfs' /etc/fstab

LABEL=cloudimg-rootfs   /        ext4   defaults,relatime       0 0
This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top