1. Theoretical Basis
1.1 fstab Introduction
Fstab describes information about various file systems in the system. Generally, an application only reads this file and does not write the file. Maintenance is the work of the system administrator.
1.2 fstab path
ls /etc/fstab
1.3 fstab writing format
cat /etc/fstab
The details are as follows:
/dev/mapper/vg_ser-lv_root / ext4 defaults 1 1UUID=6add714f-ead0-4c08-946f-0948e6d92493 /boot ext4 defaults 1 2/dev/mapper/vg_ser-lv_home /home ext4 defaults 1 2/dev/mapper/vg_ser-lv_swap swap swap defaults 0 0tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0
Format details:
Column 1: device name, device volume name, or UUID (/dev/sda10 or label =/or UUID = "5a188a8b-94a1-42a5-8bea-ad80e84e7ac4") Column 2: the third column of the mounted directory (for example, "/mnt"): file system type of the mounted device (the type can be searched by the "/-T, -- types vfstype" command after man mount) column 4: Mount options (options can be searched by the "/command line options" command after man mount, multiple options are separated by commas) Column 5: Specifies whether to back up (1 backup, 0 without backup) Column 6: indicates the self-check sequence (0 without self-check, 1 or 2 self-check, 1 self-check level is higher than for root partition)
2. Practice
2.1 Mount System partitions
2.1.1 obtain UUID
blkid /dev/sdb1 blkid /dev/mapper/vg_ser-lv_root
The partition is shown as follows:
/dev/sdb1: UUID="6add714f-ead0-4c08-946f-0948e6d92493" TYPE="ext4"
LV is displayed as follows:
/dev/mapper/vg_ser-lv_root: UUID="daaa8db7-b4a0-47e4-b02d-5f3a97f6db8a" TYPE="ext4"
Note: Only devices that have been formatted (with file systems) have UUID
2.1.2 edit fstab
vim /etc/fstab
Enter the mounting rules (for example, Mount/dev/sdb1)
UUID="6add714f-ead0-4c08-946f-0948e6d92493" /data ext4 defaults 0 2
2.1.3 mount all devices in fstab
mount -a
2.1.4 view mounting content
mount
2.2 how to mount samba
2.2.1 manual mounting Test
mount -t cifs -o username=administrator,password=pwd //192.168.0.200/D\$ /mnt
Note: The special symbol "$" in shell must use escape characters.
2.2.2 edit a mounting rule
vim /etc/fstab
Add the following content:
//192.168.0.200/D$ /mnt cifs defaults,username=administrator,password=pwd 0 0
2.2.3 mount all devices in fstab
mount -a
2.2.4 view mounting content
mount
This article is from the "Tan Linux cluster blog" blog, please be sure to keep this source http://cmdschool.blog.51cto.com/2420395/1875493
Fstab data sorting