# Installation

# Reinstall Grub after installing windows

1. Boot from a Live Linux USB drive. You can use any Live Linux distribution for this, such as Ubuntu, Fedora, or Debian.
2. Once you have booted into the Live Linux environment, open a terminal. For example; `Ctrl+Alt+T`
3. Type the following command to list all the partitions on your system: ```
    sudo fdisk -l
    ```
4. Identify the partition where your Linux operating system is installed. Note the partition name, for example, `/dev/sda1>/code>.`
5. Mount the partition with the Linux operating system: ```
    sudo mount /dev/sdx1 /mnt
    ```
    
    Replace `/dev/<span style="color: red;"><strong>sdx1</strong></span>` with the actual partition name.
6. Mount other necessary partitions: ```
    sudo mount --bind /dev /mnt/dev
    ```
    
    ```
    sudo mount --bind /proc /mnt/proc
    ```
    
    ```
    sudo mount --bind /sys /mnt/sys
    ```
7. Chroot into the mounted Linux partition: ```
    sudo chroot /mnt
    ```
8. Install the Grub bootloader: ```
    sudo grub-install /dev/sdx
    ```
    
    Again, replacing `/dev/<strong><span style="color: red;">sdx</span></strong>` with the actual device name of your hard drive. If you have more than one hard drive, make sure to select the one where the Linux operating system is installed.
9. Update the Grub configuration: ```
    sudo update-grub
    ```
10. Exit the chroot environment: ```
    exit
    ```
11. Unmount the partitions: ```
    sudo umount /mnt/dev
    ```
    
    ```
    sudo umount /mnt/proc
    ```
    
    ```
    sudo umount /mnt/sys
    ```
    
    ```
    sudo umount /mnt
    ```
12. Reboot your computer from the terminal. ```
    sudo reboot
    ```

<details id="bkmrk-my-system-sudo-fdisk"><summary>My System</summary>

<span style="font-family: monospace;"><span style="font-weight: bold; color: #54ff54; background-color: #ffffff;"> </span><span style="color: #18b218; background-color: #ffffff;">sudo</span><span style="color: #000000; background-color: #ffffff;"> fdisk </span><span style="color: #18b2b2; background-color: #ffffff;">-l</span><span style="color: #000000; background-color: #ffffff;"> </span>  
\[sudo\] password for csr:   
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors</span><span style="color: #000000; background-color: #ffffff;"> </span>  
Disk model: Samsung SSD 850   
Units: sectors of 1 \* 512 = 512 bytes   
Sector size (logical/physical): 512 bytes / 512 bytes   
I/O size (minimum/optimal): 512 bytes / 512 bytes   
Disklabel type: gpt   
Disk identifier: 18F7B150-AD7B-4AC1-9864-0391968D7FE3   
  
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Device </span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Start</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> End</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Sectors</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Size</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;">Type</span><span style="color: #000000; background-color: #ffffff;"> </span>  
/dev/sda1 4096 1232895 1228800 600M EFI System   
/dev/sda2 1232896 3330047 2097152 1G Linux filesystem   
/dev/sda3 3330048 904714755 901384708 429.8G Linux filesystem   
/dev/sda4 904714756 976768064 72053309 34.4G Linux swap   
  
  
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors</span><span style="color: #000000; background-color: #ffffff;"> </span>  
Disk model: addlink M.2 PCIE G3x4 NVMe   
Units: sectors of 1 \* 512 = 512 bytes   
Sector size (logical/physical): 512 bytes / 512 bytes   
I/O size (minimum/optimal): 512 bytes / 512 bytes   
Disklabel type: gpt   
Disk identifier: 753AD7B1-9E5B-4DC8-A1BF-4966F9CA2801   
  
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Device </span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Start</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> End</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Sectors</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Size</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;">Type</span><span style="color: #000000; background-color: #ffffff;"> </span>  
/dev/nvme0n1p1 2048 206847 204800 100M EFI System   
/dev/nvme0n1p2 206848 239615 32768 16M Microsoft reserved   
/dev/nvme0n1p3 239616 1999320142 1999080527 953.2G Microsoft basic data   
/dev/nvme0n1p4 1999321088 2000406527 1085440 530M Windows recovery environment   
  
  
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Disk /dev/zram0: 8 GiB, 8589934592 bytes, 2097152 sectors</span><span style="color: #000000; background-color: #ffffff;"> </span>  
Units: sectors of 1 \* 4096 = 4096 bytes   
Sector size (logical/physical): 4096 bytes / 4096 bytes   
I/O size (minimum/optimal): 4096 bytes / 4096 bytes   
  
  
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Disk /dev/sdb: 115.69 GiB, 124218507264 bytes, 242614272 sectors</span><span style="color: #000000; background-color: #ffffff;"> </span>  
Disk model: Ultra Fit   
Units: sectors of 1 \* 512 = 512 bytes   
Sector size (logical/physical): 512 bytes / 512 bytes   
I/O size (minimum/optimal): 512 bytes / 512 bytes   
Disklabel type: dos   
Disk identifier: 0x0d320863   
  
<span style="font-weight: bold; color: #000000; background-color: #ffffff;">Device </span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;">Boot</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Start</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> End</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Sectors</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;"> Size</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;">Id</span><span style="color: #000000; background-color: #ffffff;"> </span><span style="font-weight: bold; color: #000000; background-color: #ffffff;">Type</span><span style="color: #000000; background-color: #ffffff;"> </span>  
/dev/sdb1 \* 2048 242548735 242546688 115.7G 7 HPFS/NTFS/exFAT   
/dev/sdb2 242548736 242614271 65536 32M ef EFI (FAT-12/16/32)  
  
</span>

<span style="font-family: monospace;">mount | grep /dev/sda  
/dev/sda3 on / type btrfs (rw,relatime,compress=zstd:1,ssd,discard=async,space\_cache=v2,subvolid=400,subvol=/@)  
/dev/sda3 on /home type btrfs (rw,relatime,compress=zstd:1,ssd,discard=async,space\_cache=v2,subvolid=399,subvol=/@home)  
/dev/sda2 on /boot type ext4 (rw,noatime)  
/dev/sda1 on /boot/efi type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)  
</span>

</details>