kvm

KVM : How to run fsck on KVM

Customer having an issue with their VPS, it show like read-only error. To solve this, we need to run the fsck on the host of that VPS by follow this :

1. Shutdown the VM
2. Login to the VM host to perform the task, for this case, we are login to SSDVPS07
3. go to img file :

[root@ssdvps07 ssdvps07data]# pwd
/dev/ssdvps07data

4. Run Kpartx so that you can run FSCK :

[root@ssdvps07 ssdvps07data]# kpartx -a -p X /dev/ssdvps07data/kvm862_img

5. It will activate and allow you to make changes on it, NOW RUN FSCK

[root@ssdvps07 ssdvps07data]# e2fsck -f -y /dev/mapper/ssdvps07data-kvm862_imgX1

6. Once done deactivate the disk :

[root@ssdvps07 ssdvps07data]# kpartx -d -p X /dev/ssdvps07data/kvm862_img

7. And you can boot up the VM now.