In a dual boot environment (linux + windows) how to restrict certain disks so that only…
- User
In a dual boot environment (linux + windows) how to restrict certain disks so that only linux can read them?
- Assistant
In a dual boot environment (linux + windows) how to restrict certain disks so that only linux can read them?
To restrict certain disks in a dual boot environment (Linux + Windows) so that only Linux can read them, you need to take a few steps to ensure Windows does not recognize or interfere with those disks. Here’s how you can achieve that:
The most straightforward way to ensure that Windows does not access certain disks is to format those disks using a filesystem that Windows does not support natively.
sudo fdisk -l
/dev/sdb with Ext4, you would use the following commands:
sudo mkfs.ext4 /dev/sdb
Labeling the disk can make it easier to identify.
sudo e2label /dev/sdb linux_only_disk
Even if you've formatted the disk with a filesystem not supported by Windows, it is still a good practice to take additional steps to prevent Windows from attempting to mount the disk.
You can remove the drive letter in Windows Disk Management to prevent Windows from trying to mount the disk:
Win + X and select Disk Management.fstab in LinuxTo ensure that the disk mounts automatically in Linux:
/etc/fstab file in a text editor with sudo privileges.
sudo nano /etc/fstab
/dev/sdb /mnt/linux_only ext4 defaults 0 2
sudo mkdir -p /mnt/linux_only
/etc/fstab:
sudo mount -a
For additional security, you can encrypt the disk using LUKS (Linux Unified Key Setup). This ensures that even if someone tries to access the disk from a live bootable OS or if the disk is connected to another device, the contents remain secure.
sudo cryptsetup luksFormat /dev/sdb
sudo cryptsetup luksOpen /dev/sdb encrypted_disk
sudo mkfs.ext4 /dev/mapper/encrypted_disk
sudo cryptsetup luksOpen /dev/sdb encrypted_disk
sudo mount /dev/mapper/encrypted_disk /mnt/linux_only
By following these steps, you can effectively restrict certain disks in a dual boot environment, ensuring that only Linux has read and write access to them.
Not yet included in a published release.