Elasticsearch fix read only index

In case you have been low on disk space on your Elasticsearch instance, there is high probability that your indices are marked read only now. In order to fix this one, first either delete/archive indices or increase your disk space. After that restart Elasticsearch and Kibana and navigate to Management – Dev Tools and execute the following:

PUT /*/_settings
{
  "index.blocks.read_only_allow_delete": null
}

This should bring indices back to be writable once again.

Reinstalling GRUB

In one of my previous posts I mentioned some troubles regarding reinstalling Ubuntu 22, loosing ability to select OS and to boot at all actually. I found that Ubuntu 20 recognizes properly my fresh Windows installation but Ubuntu 22 does not. So I stayed with version 20 however here was no OS selection, which translates to broken GRUB installation. After Ubuntu 20 installation finished it tried to put bootloader but failed to do this because of drives numbering. My first drive in Lenovo Thinkpad T420s is mSATA but computer and operating system thinks that this is my second drive. My actual second drive is SSD located in regular drive bay. So, this is something that developers have not cover properly.

However you can fix this but booting Ubuntu 20 from USB/CD media and try live session. Open terminal and mount installed Ubuntu filesystem and then chroot into it.

mkdir /mnt/newroot
mount /dev/sdXY /mnt/newroot
mount --bind /proc /mnt/newroot/proc
mount --bind /sys /mnt/newroot/sys
mount --bind /dev /mnt/newroot/dev
chroot /mnt/newroot
grub-install /dev/sdX # put only drive letter and not partition number
update-grub # see whether it recognized all operating systems
exit
reboot

Then go to BIOS/UEFI and put your drive with /dev/sdX on first boot place before other drives. You can leave USB/CD/Network boot before, but do not put there other drives as they might also have bootsectors filled with bootloaders. Now after reboot, you see GRUB with OS selection.

Expand CentOS LVM disk and filesystem

There are two ways of expanding your root filesystem space. It’s either by adding additional volumes or by resizing PV. Let’s try the latter. We have CentOS 7 wth XFS running on Proxmox. First expand drive size with admin UI. Next:

yum install cloud-utils-growpart
growpart /dev/sdX 2
pvresize /dev/sdX2
lvextend -l +100%FREE /dev/mapper/centos-root
# and...
xfs_growfs / # for XFS 
# or
resize2fs /dev/mapper/centos-root

At first after resizing drive you will see in lsblk that the drive should have additional space. At growpart you will see your partition expands. At pvresize there is no change. Change happens on lvextend, so you will see you LVM increases in space. To see filesystem change in df you need to run either xfs_growfs or resize2fs depending on your filesystem you’re running on.

Windows/Ubuntu dual boot issues

I have dual boot on my Lenovo Thinkpad T420s, Windows 10 and Ubuntu 22. Actually I had, because I tried to reinstall Ubuntu 22 and I’ve lost my dual boot and ability to boot at all. So I tried few things:

  • reformat manually EFI and root partitions
  • os-prober and update-grub
  • setting root and prefix at grub rescue
  • grub-install
  • Windows installation troubleshooting

Unfortunately it does not work. Something went terribly wrong. To bring back Windows first boot from installation media and go for command prompt:

diskpart
list disk
sel disk X # select disk with Windows installed
list partition
sel partition Y # select boot partition
detail partition # in case Active is set to No then...
active
exit

This way I was able to boot into Windows once again, but unable to do it from grub and unable to boot Ubuntu any more. I also tried the following:

bootrec /fixmbr
bootrec /fixboot # does not work
bootrec /rebuildbcd

So I decided to reinstall Windows as I keep only Office, Typora and Fruity Loops there so will be easy to bring it back. After Windows reinstallation I tried to install Ubuntu one more time, but… there is no option for dual boot installation! Why? I do not know for now.