前面参考:  http://www.cnblogs.com/xiaowuyi/p/4051238.html

  • 插上硬盘,查看状态
root@raspberrypi:/home/pi# sudo fdisk -l
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/ram1: 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/ram2: 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/ram3: 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/ram4: 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/ram5: 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/ram6: 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/ram7: 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/ram8: 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/ram9: 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/ram10: 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/ram11: 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/ram12: 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/ram13: 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/ram14: 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/ram15: 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/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
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: 0xa0068976 Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 98045 89854 43.9M c W95 FAT32 (LBA)
/dev/mmcblk0p2 98304 62333951 62235648 29.7G 83 Linux Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
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: 0xff2d845c Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 976766975 976764928 465.8G 83 Linux

  

  • 使用df 命令查看自动挂载的硬盘

df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息。

root@raspberrypi:/home/pi# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 30G 4.8G 24G 18% /
devtmpfs 434M 0 434M 0% /dev
tmpfs 438M 0 438M 0% /dev/shm
tmpfs 438M 12M 427M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 438M 0 438M 0% /sys/fs/cgroup
/dev/mmcblk0p1 44M 23M 22M 51% /boot
tmpfs 88M 0 88M 0% /run/user/1000
/dev/sda1 437G 8.0K 414G 1% /media/pi/nas465

最后一行/dev/sda1说明硬盘已经挂载。

为下一步安装samba,将共享文件夹设为/samba。

于是新建文件夹:

mkdir /samba

设置访问权限:

chmod 777 /samba

将硬盘挂载到/samba文件夹:

umount /dev/sda1   #取消自动的挂载
mount /dev/sda1 /samba  #将硬盘挂载到/samba文件夹
  • 使用df 命令再次查看挂载的硬盘
root@raspberrypi:/home/pi# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 30G 4.8G 24G 18% /
devtmpfs 434M 0 434M 0% /dev
tmpfs 438M 0 438M 0% /dev/shm
tmpfs 438M 12M 427M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 438M 0 438M 0% /sys/fs/cgroup
/dev/mmcblk0p1 44M 23M 22M 51% /boot
tmpfs 88M 0 88M 0% /run/user/1000
/dev/sda1 437G 8.0K 414G 1% /samba
  • 解决硬盘的自动挂载

每次树莓派重启或者硬盘插拔都需要对硬盘进行重新挂载,比较麻烦,因此需要自动挂载。这里要修改/etc/fstab文件。 

sudo nano /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=a0068976-01 /boot vfat defaults 0 2
PARTUUID=a0068976-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that

  

修改后:

proc            /proc           proc    defaults          0       0
PARTUUID=a0068976-01 /boot vfat defaults 0 2
PARTUUID=a0068976-02 / ext4 defaults,noatime 0 1
/dev/sda1 /samba ext4 defaults 0 0
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that

  

备注:

可以看到,fstab文件其实就是一个表格,表格各列的含意如下:

第一列:磁盘分区名/卷标,一般是/dev/sdaN(N表示正整数)

第二列:挂载点,我们在这里把/dev/sda1挂到/samba上。

第三列:缺省设置,一般用defautls。

第四列:是否备份:0——表示不做 dump 备份;1——表示要将整个 <fie sysytem> 里的内容备份;2 也表示要做 dump 备份,但该分区的重要性比 1 小。

第五列:检测顺序:0——不进行检测;根分区(/),必须填写 1,其它的都不能填写 1。如果有分区填写大于 1 的话,则在检查完根分区后,从小到大依次检查下去。

  

  

  

  

树莓3B+_挂载硬盘的更多相关文章

  1. 树莓3B+_中文支持安装输入法

    参考: https://www.cnblogs.com/collisionzhang/p/7413349.html 莓派默认是采用英文字库的,而且系统里没有预装中文字库,所以即使你在locale中改成 ...

  2. 树莓3B+_安装vim

    第一步:访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑. sudo apt-get update 第二步:安装vim sudo apt-get install vim 第三步:配置vim ...

  3. kvm 动态挂载硬盘

    根据最新需求需要动态的给kvm下的windows虚拟机挂载硬盘,网上查看了很多资料终于试通了,在这里记录下方便自己回忆,同事可以给大家做做参考,如果有问题欢迎吐槽 环境:先说说我使用的环境,环境是使用 ...

  4. Linux添加新硬盘自动挂载硬盘

    Linux添加新硬盘自动挂载硬盘的具体步骤 1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘 #fdisk -l Disk /dev/sdb: 1000.2 GB, 1000204 ...

  5. linux下挂载硬盘,解决阿里云挂载后重启消失的问题

    完整的阿里云挂载数据盘方法如下: 1.入手阿里云后查看有几块硬盘:(只显示概况,不显示分区情况) fdisk -l|grep Disk 2.查看硬盘分区 fdisk -l 如果有提示:disk /de ...

  6. CentOS挂载硬盘

    1.查看当前硬盘使用状况: [root@gluster_node1 ~]# df -h 文件系统     容量 已用 可用 已用%% 挂载点 /dev/sda3 14G 2.4G 11G 19% / ...

  7. Centos下安装mysql 和挂载硬盘

    一,CentOS下安装Mysql 6.5 1.检测系统是否自带安装mysql # yum list installed | grep mysql 2.删除已经安装的Mysql # yum -y rem ...

  8. 阿里云-CentOS如何挂载硬盘

    阿里云CentOS挂载硬盘 查看当前未挂载的硬盘 # fdisk -l 创建硬盘分区 # fdisk /dev/vdb 根据提示,依次输入"n","p" &qu ...

  9. Linux 自动挂载硬盘的方法

    每次重启后,都需要手动挂载硬盘( sudo mount ),非常不方便,使用一下步骤可以实现硬盘的自动挂载 第一步  获取硬盘的基本信息(UUID TYPE) sudo blkid 第二步  修改 / ...

随机推荐

  1. Python学习---django之admin简介

    Django之admin简介 参考文献:http://www.admin10000.com/document/2220.html   Djaogo为什么url可以匹配url.py里面的路径呢? 我们打 ...

  2. December 20th 2016 Week 52nd Tuesday

    With the wonder of your love, the sun above always shines. 拥有你美丽的爱情,太阳就永远明媚. To accept the love from ...

  3. Current urgent plan(3/30)

    1. resume improving 1.1 project from Udacity 1.2 project from class 1.3 find career center's help 1. ...

  4. python的进度条实现

    进度条最主要的问题就是所有字符全部在同一行,而且可以修改.然而当执行print语句的时候,python会在打印完这个语句的同时,在结尾加上换行‘\n’,这就导致在控制台下一旦被print之后就无法修改 ...

  5. java aopalliance-1.0.jar这个包是做什么用的?

    这个包是AOP联盟的API包,里面包含了针对面向切面的接口.通常Spring等其它具备动态织入功能的框架依赖此包.

  6. Django重定向的写法、与直接渲染的区别

    Django重定向的写法.与直接渲染的区别 return redirect (“login”)     #重定向到login页面,状态码是302页面重定向和直接渲染新的页面的区别.重定向实际是指向了另 ...

  7. windows C++ new/delete内存大小

    转载自:https://blog.csdn.net/will_hsbsch/article/details/21124055 windows 上,但使用C++语言new一块内存,用指针P指向这块内存, ...

  8. ZooKeeper学习之路 (五)ZooKeeper API的简单使用 增删改查

    zookeeper文件系统的增删改查 public class ZKDemo1 { private static final String CONNECT_STRING = "hadoop1 ...

  9. [SQL注入] 逗号拦截绕过

    在SQL注入时,在确定了注入点后,一般都需要使用联合查询猜表的列数,也就是常见的order by n,n从大到小,直到返回正常,就确定了当前查询的列的个数. 然后再使用 UNION SELECT 1, ...

  10. [Python 多线程] GIL全局解释器锁 (十三)

    Queue 标准库queue模块,提供FIFO(先进先出)的Queue.LIFO(后进先出)的队列.优先队列. Queue类是线程安全的,适用于多线程间安全的交换数据.内部使用了Lock和Condit ...