Set the boot automatically mount

Following the last time for the re-allocation of disk space, but over time found that the boot space is still full, which is very puzzling, and not set up properly before it?

1. identify problems

dfWe did not find a good set before/dev/sda2和/dev/sda3

root@wzy:~# df
文件系统          1K-块    已用   可用 已用% 挂载点
udev             736936       0 736936    0% /dev
tmpfs            152212    1432 150780    1% /run
/dev/sda1      10253588 9253136 459884   96% /
tmpfs            761056      12 761044    1% /dev/shm
tmpfs              5120       4   5116    1% /run/lock
tmpfs            761056       0 761056    0% /sys/fs/cgroup
/dev/loop1         3840    3840      0  100% /snap/gnome-system-monitor/100
/dev/loop2        43904   43904      0  100% /snap/gtk-common-themes/1313
/dev/loop3        15104   15104      0  100% /snap/gnome-characters/317
/dev/loop5       144128  144128      0  100% /snap/gnome-3-26-1604/92
/dev/loop4         4352    4352      0  100% /snap/gnome-calculator/501
/dev/loop6         2304    2304      0  100% /snap/gnome-calculator/260
/dev/loop0       153600  153600      0  100% /snap/gnome-3-28-1804/71
/dev/loop7        55936   55936      0  100% /snap/core18/1279
/dev/loop8         3840    3840      0  100% /snap/gnome-system-monitor/57
/dev/loop9         1024    1024      0  100% /snap/gnome-logs/73
/dev/loop11      144128  144128      0  100% /snap/gnome-3-26-1604/74
/dev/loop10       93184   93184      0  100% /snap/core/6350
/dev/loop12       14976   14976      0  100% /snap/gnome-logs/45
/dev/loop13       91264   91264      0  100% /snap/core/7713
/dev/loop14       13312   13312      0  100% /snap/gnome-characters/139
/dev/loop16       55808   55808      0  100% /snap/core18/1144
/dev/loop15       35456   35456      0  100% /snap/gtk-common-themes/818
<pre>tmpfs            152208      44 152164    1% /run/user/1000
/dev/sr0          75386   75386      0  100% /media/wzy/VBox_GAs_6.0.12
tmpfs            152208       0 152208    0% /run/user/0
2. reasons

With a df /data/ext4view, as it has been previously set up, so here is already modified remember correctly before the amendment is 已用100% 挂载点为 \, which means the last mount failure, but we can not always have a manual start mount it, very troublesome.

wzy@wzy:~$ df /data/ext4
文件系统        1K-块  已用   可用 已用% 挂载点
/dev/sda3      999320  8080 922428    1% /data/ext4

With a cat /etc/fstabview of the current mount, the documents show only one mount ext4 file system root directory, shown here is unmodified.

root@wzy:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=777c74fb-a653-4051-8c82-1f366bc6bcab /               ext4    errors=remount-ro 0       1
/swapfile   none            swap    sw              0       0

A total of six columns, representing the meaning of

[The UUID Device] [mount point] [File System] [File System Parameters] [for backup] [Do you want to do the action of the check at boot]

2. Solution

In order to be able to boot automatically required to mount the file system is mounted well, we need to edit the file/etc/fstab

First of all to emphasize points

  1. The root directory \is to be mounted, but must first be mounted to other mount points come

  2. The other must mount point, can be specified for the directory has been established, but the system must comply with the principle of mandatory directory structure (FHS)

  3. All mount points at the same time, the only one mount

  4. All hard disk partitions at the same time, the only one mount

  5. Should the uninstall, you must first working directory to outside the mount point (and its subdirectories)

    - From "Bird Brother Linux private kitchens"

In rootthe user with a blkidview of the file system UUID, the contents of the form should look similar

/dev/sda1: UUID="777c74fb-a653-4051-8c82-1f366bc6bcab" TYPE="ext4" PARTUUID="724e98f6-01"
/dev/sda2: UUID="53c0cfd8-7fbc-4095-9b79-bdf57d928ec9" TYPE="xfs" PARTUUID="724e98f6-02"
/dev/sda3: UUID="2645e5a9-2bee-447d-8b00-7eb6576fc20c" TYPE="ext4" PARTUUID="724e98f6-03"

Edit the /etc/fstabfile vim /etc/fstab, UUIDis above /dev/sda2a bar, mounted filesystem is ext4 format, so before you create the mount point for the /data/ext4file system parameters to fill defaults, dump和passthe default fill 0 on the line, if you want to learn more about the /etc/fstabinformation file, refer to / etc / Detailed fstab file

Modify the file /etc/fstab

Write file is set automatically mount the boot, substantially modified so

root@wzy:/data/ext4# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=777c74fb-a653-4051-8c82-1f366bc6bcab /               ext4    errors=remount-ro 0       1
/swapfile   none            swap    sw              0       0
UUID=53c0cfd8-7fbc-4095-9b79-bdf57d928ec9   /data/xfs   xfs defaults    0   0
UUID=2645e5a9-2bee-447d-8b00-7eb6576fc20c   /data/ext4  ext4    defaults 0  0
3. Check mount successful

First df, I learned to mount successfully, restart it, life has not changed

Note: If you do not take effect immediately, with mount -aresolve, I would not take effect immediately ...

lsblkLook, confirm the correct mount to complete.

sda      8:0    0    20G  0 disk 
├─sda1   8:1    0    10G  0 part /
├─sda2   8:2    0     1G  0 part /data/xfs
└─sda3   8:3    0     1G  0 part /data/ext4

Reference link: https: //blog.csdn.net/lanmolei814/article/details/45692153

Guess you like

Origin www.cnblogs.com/NoTrace/p/12000176.html