1.创建挂载目录
mkdir /home/pi/nas
2.查看移动硬盘
sudo fdisk -l
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/sda: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors Disk model: EXTERNAL_USB Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x7467e3f0 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1953522863 1953520816 931.5G 7 HPFS/NTFS/exFAT |
3.挂载移动硬盘
sudo mount -o uid=pi,gid=pi /dev/sda1 /home/pi/nas
错误
mount: /home/pi/nas: wrong fs type, bad option, bad superblock on /dev/sda1,
wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error.
先
sudo apt-get install exfat-fuse 支持mac电脑的exfat格式
sudo apt-get install ntfs-3g 支持windows的ntfs格式
重新插盘
4.查看磁盘uuid:
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
1 2 3 4 5 6 |
UUID NAME FSTYPE SIZE MOUNTPOINT LABEL MODEL sda 931.5G EXTERNAL_USB 6442-062E └─sda1 exfat 931.5G /home/pi/nas Toshiba1T mmcblk0 14.9G F8C9-55AB ├─mmcblk0p1 vfat 256M /boot boot eae7cc40-f1d2-4bf1-8b9b-ccab61498abe └─mmcblk0p2 ext4 14.6G / rootfs |
5.加入开机自动挂载
sudo nano /etc/fstab
加入一行:
UUID=6442-062E /home/pi/nas/ exfat defaults,auto,users,rw,nofail 0 0
6.国内源
sudo nano /etc/apt/sources.list
cat /etc/apt/sources.list
1 2 3 4 5 6 7 8 9 10 11 12 |
#deb http://deb.debian.org/debian buster main contrib non-free #deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free #deb http://deb.debian.org/debian buster-updates main contrib non-free # Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source' #deb-src http://deb.debian.org/debian buster main contrib non-free #deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free #deb-src http://deb.debian.org/debian buster-updates main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free deb https://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free |
7.安装samba
sudo apt-get update
sudo apt-get install samba
8.添加samba无密码账户
sudo nano /etc/samba/smb.conf
末尾添加内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#这个[nas]即其它电脑访问时用的路径。 [nas] # 共享说明 comment = nas # 共享文件夹目录 path = /home/pi/nas/ # 可被其他人看到资源名称(非内容) browseable = yes # 可写 writable = yes # 新建文件的权限为 777 create mask = 0777 # 新建目录的权限为 777 directory mask = 0777 # public = yes表示:开启无密码账户guest,无需密码 public = yes |
9.添加samba密码账户
sudo smbpasswd -a pi
输入两次自定义密码。如:raspberry
重启samba服务
sudo systemctl restart smbd
例mac上访问:
10.vnc远程桌面配置
sudo apt-get install tightvncserver
tightvncserver
1 2 3 4 5 6 7 8 9 |
You will require a password to access your desktops. Password: 【自定义密码。如:raspberry】 Warning: password truncated to the length of 8. Verify: 【确认密码】 Would you like to enter a view-only password (y/n)? n 【这里敲入的是n,拒绝只读】 New 'X' desktop is raspberrypi:1 Creating default startup script /home/pi/.vnc/xstartup Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:1.log |
tightvncserver
1 2 3 |
New 'X' desktop is raspberrypi:2 【端口号是2】。 Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:2.log |
- end
本文由崔维友 威格灵 cuiweiyou vigiles cuiweiyou 原创,转载请注明出处:http://www.gaohaiyan.com/4303.html
承接App定制、企业web站点、办公系统软件 设计开发,外包项目,毕设