How to automatically mount the inserted U disk in debian
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 blkid and 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/fstab and 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/usb and press Enter. This command will create a directory where the USB disk will be mounted.
- Type the command sudo mount -a and 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 -h and 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/cHzl 著作权归作者所有。请勿转载和采集!