因此,我为我们的 Linux 机器制作了一个新映像,但我需要修改新/etc/fstab
文件,以便能够使用命令mount -a
来使用旧文件中找到的用户名/密码挂载特定地址/etc/fstab
。
我需要做什么才能使其与旧系统一样工作。我得到了如何从本地 PC 读取文件的方法,我知道更改这些文件会导致系统故障(至少当我尝试使用以前的文件时)
旧的 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=########-####-####-####-############ / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=########-####-####-####-############ none swap sw 0 0
//192.168.0.10/data /mnt/db cifs ro,iocharset=utf8,username=#####,password=##### 0 0
新文件看起来像这样
# /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>
/dev/mapper/lubuntu--vg-root / ext4 errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
UUID=########-####-####-####-############ /boot ext2 defaults 0 2
/dev/mapper/lubuntu--vg-swap_1 none swap sw 0 0
我想在新文件中使用旧文件(如下)的最后一行,但我不确定在使用命令时旧文件还需要什么才能使这项工作正常sudo mount -a
进行
//192.168.0.10/data /mnt/db cifs ro,iocharset=utf8,username=######,password=##### 0 0