Automatic USB Drive Mounting in Debian: A Step-by-Step Guide
To automatically mount a USB disk in Debian, you can follow these steps:
- Insert the USB disk into the USB port of your computer.
- Open a terminal window.
- Type the command
sudo blkidand press Enter. This command will show you the list of connected devices and their UUIDs. - Identify the UUID of your USB disk.
- Type the command
sudo nano /etc/fstaband press Enter. This command will open the fstab file in the nano text editor. - Add the following line at the end of the file, replacing 'UUID' with the UUID of your USB disk:
UUID=YOUR-UUID /mnt/usb vfat defaults 0 0
- Press Ctrl+X, then Y, and then Enter to save and exit the file.
- Type the command
sudo mkdir /mnt/usband press Enter. This command will create a directory where the USB disk will be mounted. - Type the command
sudo mount -aand press Enter. This command will mount all the devices listed in the fstab file, including your USB disk. - To verify that the USB disk has been mounted, type the command
df -hand press Enter. This command will show you the list of mounted devices and their mount points. Your USB disk should be listed with the mount point/mnt/usb.
From now on, whenever you insert your USB disk into the USB port, it will be automatically mounted in the /mnt/usb directory.
原文地址: https://www.cveoy.top/t/topic/nywr 著作权归作者所有。请勿转载和采集!