Brief introduction
Record implement a disk you want to mount under the directory Ubuntu18.04 desktop systems, reference content online tutorials, recorded here for their own operations.
See all current disk information
Command: sudo fdisk -l
As can be seen from the information that is listed in the two computer hard drives and respectively sda sdb. systems and software under win10 win10 sdb mounting a solid state disk, sda installed Linux system, sda3 with sda4 for file storage under win10, with "Microsoft Basic Data" identifier; for the remaining disks using Linux, sda1 and sda2 as a Linux file storage, with "Linux basic data" logo. Sda2 now ready to mount the / home directory, still as a storage disk, you can expand / home space.
Create a mount point
Standing / home /usernameCreate a mount point, that is, create an empty folder. The use of the desktop version of the system, it can be in / home /usernameDirectory directly create a new folder, or create it using the command line
cd / home /
username
mkdirFolder name
Uninstall disk
Want to have to mount a disk to a directory, you need to uninstall the disk from the system. For desktop systems, unmount the disk can open the file manager - displaying other location> -> right corresponds to disk -> Uninstall option to uninstall the completion of the current existing disk; or via the command line.
First use the command to view the current disk mount case
df -kh
Then uninstall command
sudo umount /dev/sda2
Use the command again to view the current situation can be seen in the disk mount / dev / sda2 he has not mounted a.
Disk Mount
First use the command View / dev / sda2's UUID
sudo blkid /dev/sda2
Complete mounted disk you need to edit / etc / fstab file, use the command
sudo gedit /etc/fstab
根据/etc/fstab文件的内容格式在最后添加:UUID=96d37587-bd18-4ab0-80e5-02d80ffa0b6a /home/liniuniu/usrdisk ext4 defaults 0 2
保存退出。
第一列为UUID, 第二列为挂载目录(该目录必须为一个空白目录),第三列为文件系统类型,第四列为参数,第五列0表示不备份,最后一列必须为2或0(除非引导分区为1)
磁盘挂载
执行命令进行磁盘挂载
sudo mount -a
可以通过命令再次查看磁盘挂载点,/dev/sda2磁盘的挂载目录已经变成字节新建的文件夹目录下。