树莓派4B-挂载硬盘
作者:互联网
查看硬盘
sudo fdisk -l
Disk /dev/loop0: 48.86 MiB, 51212288 bytes, 100024 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 Disk /dev/loop1: 26.102 MiB, 28307456 bytes, 55288 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 Disk /dev/loop2: 61.61 MiB, 64589824 bytes, 126152 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 Disk /dev/loop3: 48.93 MiB, 51286016 bytes, 100168 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 Disk /dev/loop4: 28.5 MiB, 29413376 bytes, 57448 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 Disk /dev/mmcblk0: 29.74 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: 0x4ec8ea53 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 526336 62333918 61807583 29.5G 83 Linux Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors Disk model: Generic DISK01 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: 0x5f4d45e4 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 1953525167 1953523120 931.5G 83 Linux
前边一堆都是写入操作系统时分配的,最后一个/dev/sda 是我的硬盘,/dev/sda1 是我的硬盘之前的分区
磁盘里的数据都不要了,直接格式化硬盘
mkfs.ext4 /dev/sda
挂载硬盘
sudo mkdir /data sudo mount /dev/sda /data sudo chown -R ubuntu:ubuntu /data
查看挂载结果
df -h
开机自动挂载
vi /etc/fstab # 写入以下内容 /dev/sda /data ext4 defaults 0 0
标签:树莓,Disk,sectors,bytes,dev,512,4B,硬盘,size 来源: https://www.cnblogs.com/liubin0509/p/14725554.html