sudo mkdir /mnt
sudo mount /dev/sdXn /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sdX
(if not chroot : grub-install --root-directory=/mnt/ /dev/sdX)
grub-install --recheck /dev/sdX
update-grub
exit
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt
---------
other command:
sudo fdisk -l
sudo parted /dev/sdX print
sudo lsblk