是4个硬盘+星际蜗牛,因为电源线的问题从203号拖到现在才搞定。。
首先是分区,以/dev/sdb为例(其他都是一样的)
luke7000@luke7000-nas1:~$ sudo parted /dev/sdb GNU Parted 3.3 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mktable New disk label type? gpt (parted) p Model: ATA WD40PURX-89GVNY0 (scsi) Disk /dev/sdb: 4001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags (parted) mkpart primary 0% 100% (parted) toggle 1 lvm (parted) p Model: ATA WD40PURX-89GVNY0 (scsi) Disk /dev/sde: 4001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 4001GB 4001GB primary lvm (parted) q Information: You may need to update /etc/fstab.
然后就是pv-vg-lvm一条龙了
luke7000@luke7000-nas1:~$ sudo pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 Physical volume "/dev/sdb1" successfully created. Physical volume "/dev/sdc1" successfully created. Physical volume "/dev/sdd1" successfully created. Physical volume "/dev/sde1" successfully created. luke7000@luke7000-nas1:~$ sudo vgcreate vg-nas1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 Volume group "vg-nas1" successfully created luke7000@luke7000-nas1:~$ sudo lvcreate -l 100%FREE -n lvg-nas1 vg-nas1 Logical volume "lvg-nas1" created.
格式化一下
luke7000@luke7000-nas1:~$ sudo mkfs.ext4 /dev/vg-nas1/lvg-nas1 mke2fs 1.45.5 (07-Jan-2020) Creating filesystem with 3907014656 4k blocks and 488378368 inodes Filesystem UUID: cc3a7e83-d7f1-46f5-9407-d29aa6c2f273 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544, 1934917632, 2560000000, 3855122432 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done
挂载一下
luke7000@luke7000-nas1:~$ mkdir lvg-nas1 luke7000@luke7000-nas1:~$ sudo nano /etc/fstab luke7000@luke7000-nas1:~$ sudo blkid /dev/sda2: UUID="5da4ab14-3ff8-463b-90d6-81c5009cc603" TYPE="ext4" PARTUUID="05188ab9-af6e-4cc3-93ed-79bdbcb6fa4d" /dev/sdb1: UUID="pIJrNf-pfGE-2QE7-D01K-IJdt-Cy1e-SKr3Y0" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="b00ae221-0bd6-4020-9490-07ed818f95c3" /dev/sdc1: UUID="p9ywoI-ByBh-oRSx-OOH6-z0Ko-xutN-eByCp0" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="a31ce104-efd7-4591-a988-bdc321dcb206" /dev/sde1: UUID="te3ZE3-u8O4-dFx9-XfGU-INkq-zZSG-Ooc2Pq" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="e267d434-e053-4728-ba1d-cd6f9dcb6a2d" /dev/sdd1: UUID="aspD8T-9lBV-BZDw-O7XV-uU95-ZX3A-muVaPq" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="f0fb9c08-7130-4af5-b562-f7cf8984e906" /dev/mapper/vg--nas1-lvg--nas1: UUID="cc3a7e83-d7f1-46f5-9407-d29aa6c2f273" TYPE="ext4" /dev/loop0: TYPE="squashfs" /dev/loop1: TYPE="squashfs" /dev/loop2: TYPE="squashfs" /dev/loop3: TYPE="squashfs" /dev/loop4: TYPE="squashfs" /dev/loop5: TYPE="squashfs" /dev/loop6: TYPE="squashfs" /dev/sda1: PARTUUID="c73c3338-f5ff-4234-8866-5c8d66c62dd3" luke7000@luke7000-nas1:~$ sudo nano /etc/fstab *末尾加上: UUID=cc3a7e83-d7f1-46f5-9407-d29aa6c2f273 /home/luke7000/lvg-nas1 ext4 auto,user,rw 0 0 luke7000@luke7000-nas1:~$ chmod 755 lvg-nas1/
最后重启一下看看结果。。
luke7000@luke7000-nas1:~$ df -lh Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 383M 2.6M 380M 1% /run /dev/sda2 15G 5.7G 8.1G 42% / tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/loop0 99M 99M 0 100% /snap/core/10823 /dev/loop1 56M 56M 0 100% /snap/core18/1944 /dev/loop3 20M 20M 0 100% /snap/minidlna-escoand/19 /dev/loop2 70M 70M 0 100% /snap/lxd/19188 /dev/loop4 56M 56M 0 100% /snap/core18/1988 /dev/loop6 32M 32M 0 100% /snap/snapd/10707 /dev/loop5 32M 32M 0 100% /snap/snapd/11036 /dev/mapper/vg--nas1-lvg--nas1 15T 18M 14T 1% /home/luke7000/lvg-nas1 tmpfs 383M 0 383M 0% /run/user/1000
好耶!
关于transmission配置,预定用Transmission Remote GUI,但想换用户启动这软件。。
https://github.com/transmission-remote-gui/transgui
sudo systemctl stop transmission-daemon.service sudo nano /etc/init.d/transmission-daemon *改USER=luke7000 sudo systemctl edit transmission-daemon.service [Service] User=luke7000 nano ~/.config/transmission-daemon/settings.json ... "download-dir": "/home/luke7000/lvg-nas1/download", ... "rpc-enabled": true, "rpc-host-whitelist": "", "rpc-host-whitelist-enabled": true, "rpc-password": "{bd4ba6b1f923212294efb567b61716f7e44c858ekth9XGhJ", "rpc-port": 9091, "rpc-url": "/transmission/", "rpc-username": "luke7000", "rpc-whitelist": "127.0.0.1", "rpc-whitelist-enabled": false, ... sudo systemctl daemon-reload sudo systemctl start transmission-daemon.service
然后就是samba配置
sudo apt install samba samba-common sudo nano /etc/samba/smb.conf 在最后加: [share] comment = luke7000-nas1 browseable = yes path = /home/luke7000/lvg-nas1 create mask = 0700 directory mask = 0700 valid users = luke7000 force user = luke7000 force group = luke7000 public = yes available = yes writable = yes (给samba用户加个密码) sudo smbpasswd -a luke7000 sudo service smbd restart
最后是vsftpd,是本地用户登录模式,允许写
listen=YES listen_ipv6=NO anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 chown_uploads=NO connect_from_port_20=NO pasv_enable=YES pasv_min_port=50000 pasv_max_port=60000 chroot_local_user=YES chroot_local_user=YES chroot_list_enable=NO dual_log_enable=YES allow_writeable_chroot=YES userlist_enable=YES userlist_deny=NO userlist_file=/etc/vsftpd/user_list
最后在路由器加一条到nas的,外21-内21的映射
大概就ok了。。吧
先这样吧= =