我正在尝试为外部硬盘驱动器创建自动安装,但它一直失败。我是 linux 的一个小新手。
我在 StackExchange 中进行了谷歌搜索和搜索,尝试了很多方法,但没有找到解决问题的方法。
操作系统:Raspbian Stretch
这些是我所做的步骤:
将外部驱动器格式化为 ext4
sudo mkfs.ext4 /dev/sda1 -L hdd_moc
mke2fs 1.43.4 (31-Jan-2017)
/dev/sda1 contains a ext4 file system labelled 'hdd_owncloud'
last mounted on Mon Feb 12 09:34:38 2018
Proceed anyway? (y,N) y
Creating filesystem with 244181760 4k blocks and 61046784 inodes
Filesystem UUID: b9b47e44-db76-40de-a0ed-940c9699799a
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
为挂载的外部 USB 驱动器创建目录
sudo mkdir /mnt/hdd_moc
为组创建 www-data 用户
sudo groupadd www-data
sudo usermod -a -G www-data www-data
授予权限
sudo chown -R www-data:www-data /mnt/hdd_moc
sudo chmod -R 775 /mnt/hdd_moc
ls -l /mnt
total 4
drwxrwxr-x 2 www-data www-data 4096 Feb 12 10:06 hdd_moc
获取gid、uid和uuid
id -g www-data
33
id -u www-data
33
ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 15 Feb 12 09:49 9a7608bd-5bff-4dfc-ac1d-63a956744162 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Feb 12 09:49 B60A-B262 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Feb 12 10:12 b9b47e44-db76-40de-a0ed-940c9699799a -> ../../sda1
给 fstab 指令
sudo nano /etc/fstab
proc /proc proc defaults 0 0
PARTUUID=ed7ab5b3-01 /boot vfat defaults 0 2
PARTUUID=ed7ab5b3-02 / ext4 defaults,noatime 0 1
UUID=b9b47e44-db76-40de-a0ed-940c9699799a /mnt/hdd_moc auto nofail,uid=33,gid=33,umask=0027,dmask=0027,noatime 0 0
自动挂载测试
sudo mount -a
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
正常安装测试
sudo mount /dev/sda1 /mnt/hdd_moc -> It works, I can do a "ls".
所以我认为我的问题出在 fstab 的第 4 行。我阅读了 fstab 信息,但我不明白我应该做什么。( https://wiki.debian.org/fstab )
谢谢 :)