His Masters' Voices Wiki

よろずのことの書き残し

ユーザ用ツール

サイト用ツール


nas:readynas_duo_v2_openwrt_fstab

fstabを設定する

概要

OpenWRTでは、普通のLinuxのように /etc/fstab に書き込んでもだめみたいである。

Fstab Configuration|OrenWrt https://openwrt.org/docs/guide-user/storage/fstab

手順

blockコマンドとuciコマンドで/etc/config/fstabを生成し、 /dev/md2 と /dev/md3 の option enabled を0から1に変更する。

root@OpenWrt:~# cp /etc/config/fstab /etc/config/fstab.ORIGINAL
root@OpenWrt:~# block detect | uci import fstab
root@OpenWrt:~# vi /etc/config/fstab
root@OpenWrt:~# cat /etc/config/fstab

config global
	option anon_swap '0'
	option anon_mount '0'
	option auto_swap '1'
	option auto_mount '1'
	option delay_root '5'
	option check_fs '0'

config mount
	option target '/mnt/sda1'
	option uuid 'db4b6bad-fcf4-d760-af61-80fe2f42ca1e'
	option enabled '0'

config mount
	option target '/mnt/sda2'
	option uuid '133d7fd3-0120-9fbf-5004-cb32421736b5'
	option enabled '0'

config mount
	option target '/mnt/sda3'
	option uuid 'bee41517-55b3-802c-f940-4605bc06b2d9'
	option enabled '0'

config mount
	option target '/mnt/sdb1'
	option uuid 'db4b6bad-fcf4-d760-af61-80fe2f42ca1e'
	option enabled '0'

config mount
	option target '/mnt/sdb2'
	option uuid '133d7fd3-0120-9fbf-5004-cb32421736b5'
	option enabled '0'

config mount
	option target '/mnt/sdb3'
	option uuid 'bee41517-55b3-802c-f940-4605bc06b2d9'
	option enabled '0'

config swap
	option device '/dev/md2'
	option enabled '1'

config mount
	option target '/mnt/md3'
	option uuid 'eddcf2be-32f6-4be7-9c58-85dccafcf382'
	option enabled '1'

root@OpenWrt:~# 

確認

hiroshi@VPCF24AJ-ubuntu:~$ ssh root@192.168.10.2
root@192.168.10.2's password: 


BusyBox v1.35.0 (2022-05-20 19:00:24 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r19689-19ef3b54f4
 -----------------------------------------------------
root@OpenWrt:~# 
root@OpenWrt:~# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime,assert=read-only,ubi=0,vol=1)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,noexec,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
/dev/md3 on /mnt/md3 type ext4 (rw,relatime)
root@OpenWrt:~# cat /proc/swaps 
Filename				Type		Size		Used		Priority
/dev/md2                                partition	1044476		0		-2
root@OpenWrt:~# ls /mnt/md3
TESTFILE    lost+found
root@OpenWrt:~# 

ReadyNASの再起動後、/dev/md2 の swapも有効となり、/dev/md3 のファイルシステムも /mnt/md3 にマウントされ使用可能になっていることを確認。

nas/readynas_duo_v2_openwrt_fstab.txt · 最終更新: 2022/05/28 18:38 by nipa28