用qBittorrent下载文件有些资源上传率很低,下载很慢,就会对机械硬盘频繁读写,这样会导致硬盘寿命缩短。虽然组了RAID5,但是还是希望硬盘能活得久一点吧。所以买了一块新固态专门用来下载文件,作为临时存放,等文件下载完了再整块拷贝到RAID5里。OMV本来挂载新硬盘很简单的,UI页面点点就可以了,不知道是不是因为我这块硬盘是通过PCIe转接卡接在主板上的,挂载一直报错。

OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; omv-salt deploy run --no-color fstab 2>&1' with exit code '1': /usr/lib/python3/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.18) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

网上找了一圈也没找到解决办法,只好自己手动挂载了。

首先查看新硬盘的设备名:

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
nvme0n1     259:0    0 931.5G  0 disk  

使用fdisk命令对硬盘进行分区:

fdisk /dev/nvme0n1
Welcome to fdisk (util-linux 2.39.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


# 输入n表示新建分区
Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
# 输入p表示主分区
Select (default p): p
# 分区号直接回车使用默认的,新硬盘应该为1
Partition number (2-128, default 2):
# 输入两次回车使用默认的,从第一个扇区开始,到最后一个扇区结束,即整个硬盘
# 我因为已经分区完了,所以找了以前的笔记,所以扇区号和实际的大小,你们只需要两次回车就行了
First sector (1001472-452984798, default 1001472):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1001472-452984798, default 452982783):

# 输入w保存退出
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
# 分区完成了

格式化分区:

mkfs.ext4 /dev/nvme0n1p1
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 244189696 4k blocks and 61054976 inodes
Filesystem UUID: 1b1b1b1b-1b1b-1b1b-1b1b-1b1b1b1b1b1b
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848

创建挂载点:

# 在NAS上创建一个目录,用来挂载新硬盘,我的硬盘都挂载在了srv目录下,所以这里也挂载在srv下
mkdir /srv/download-disk

挂载硬盘:

mount /dev/nvme0n1p1 /srv/download-disk

查看挂载情况:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.6G     0  7.6G   0% /dev
tmpfs           1.6G   13M  1.5G   1% /run
/dev/sda1       116G   97G   14G  88% /
tmpfs           7.6G     0  7.6G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.6G     0  7.6G   0% /sys/fs/cgroup
/dev/nvme0n1p1  916G   28K  870G   1% /srv/download-disk

为文件系统打上标签,为了能在NAS中能方便区分硬盘,我就用了硬盘的品牌和容量:

e2label /dev/nvme0n1p1 Kingston1tb

查看标签:

$ blkid

设置自动挂载,编辑/etc/fstab文件,每次重启后都会自动挂载:

echo "/dev/nvme0n1p1 /srv/download-disk ext4 defaults 0 0" >> /etc/fstab