RaspberryPi Read-onlyになったSDの修正方法 2014.1.6 shellvalley

-----------------------------------------------------------------------------
Read-onlyになったSDの修正方法(外付けして修正する)


ramdisk用の修正していたところ、すべての領域でread-only状態になってしまった。

修正ファイル
  /etc/fstab
  /etc/rc.local
  /etc/rsyslog.conf


すべてのファイルに書き込めなくなってしまった時の修正方法

@書き込めることのできるOS(SDカード)にてboot
A修正したいSDはまだセットしない

-----------------------------------------------------------------------------
root@pi-178:/dev# ls
MAKEDEV i2c-1 mmcblk0p1 ram15 sndstat tty19 tty33 tty48 tty62 vcs5
autofs input mmcblk0p2 ram2 stderr tty2 tty34 tty49 tty63 vcs6
block kmsg net ram3 stdin tty20 tty35 tty5 tty7 vcsa
btrfs-control log network_latency ram4 stdout tty21 tty36 tty50 tty8 vcsa1
bus loop-control network_throughput ram5 tty tty22 tty37 tty51 tty9 vcsa2
cachefiles loop0 null ram6 tty0 tty23 tty38 tty52 ttyAMA0 vcsa3
char loop1 ppp ram7 tty1 tty24 tty39 tty53 uinput vcsa4
console loop2 ptmx ram8 tty10 tty25 tty4 tty54 urandom vcsa5
cpu_dma_latency loop3 pts ram9 tty11 tty26 tty40 tty55 vc-cma vcsa6
disk loop4 ram0 random tty12 tty27 tty41 tty56 vc-mem xconsole
fb0 loop5 ram1 raw tty13 tty28 tty42 tty57 vchiq zero
fd loop6 ram10 rfkill tty14 tty29 tty43 tty58 vcs
full loop7 ram11 root tty15 tty3 tty44 tty59 vcs1
fuse mapper ram12 sda tty16 tty30 tty45 tty6 vcs2
hwrng mem ram13 shm tty17 tty31 tty46 tty60 vcs3
i2c-0 mmcblk0 ram14 snd tty18 tty32 tty47 tty61 vcs4
root@pi-178:/dev#
-----------------------------------------------------------------------------

BSDをUSBを接続
-----------------------------------------------------------------------------
root@pi-178:/dev# ls
MAKEDEV i2c-0 mmcblk0 ram14 sda2 tty16 tty30 tty45 tty6 vcs2
autofs i2c-1 mmcblk0p1 ram15 shm tty17 tty31 tty46 tty60 vcs3
block input mmcblk0p2 ram2 snd tty18 tty32 tty47 tty61 vcs4
bsg kmsg net ram3 sndstat tty19 tty33 tty48 tty62 vcs5
btrfs-control log network_latency ram4 stderr tty2 tty34 tty49 tty63 vcs6
bus loop-control network_throughput ram5 stdin tty20 tty35 tty5 tty7 vcsa
cachefiles loop0 null ram6 stdout tty21 tty36 tty50 tty8 vcsa1
char loop1 ppp ram7 tty tty22 tty37 tty51 tty9 vcsa2
console loop2 ptmx ram8 tty0 tty23 tty38 tty52 ttyAMA0 vcsa3
cpu_dma_latency loop3 pts ram9 tty1 tty24 tty39 tty53 uinput vcsa4
disk loop4 ram0 random tty10 tty25 tty4 tty54 urandom vcsa5
fb0 loop5 ram1 raw tty11 tty26 tty40 tty55 vc-cma vcsa6
fd loop6 ram10 rfkill tty12 tty27 tty41 tty56 vc-mem xconsole
full loop7 ram11 root tty13 tty28 tty42 tty57 vchiq zero
fuse mapper ram12 sda tty14 tty29 tty43 tty58 vcs
hwrng mem ram13 sda1 tty15 tty3 tty44 tty59 vcs1
root@pi-178:/dev#
-----------------------------------------------------------------------------
sda1,sda2が増えている

CSDの確認

-----------------------------------------------------------------------------
root@pi-178:/dev# df
ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置
rootfs 3775184 2940888 646476 82% /
/dev/root 3775184 2940888 646476 82% /
devtmpfs 183156 0 183156 0% /dev
tmpfs 38292 508 37784 2% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 76560 0 76560 0% /run/shm
/dev/mmcblk0p1 57288 19064 38224 34% /boot
/dev/sda1 57288 19064 38224 34% /media/C522-EA52
/dev/sda2 3775184 2932844 654520 82% /media/62ba9ec9-47d9-4421-aaee-71dd6c0f3707
root@pi-178:/dev#
-----------------------------------------------------------------------------
sda1とsda2が増えている

Dマウントする
-----------------------------------------------------------------------------
root@pi-178:/dev# mkdir usb
root@pi-178:/dev# mount /dev/sda2 /dev/usb
root@pi-178:/dev# cd usb
root@pi-178:/dev/usb# ls
Desktop dev lib mjpg-streamer proc run srv usr wiringPi
bin etc lost+found mnt ramdisk.sh sbin sys var
boot home media opt root selinux tmp vnc_camera.sh
root@pi-178:/dev/usb#
-----------------------------------------------------------------------------

E修正等
ここでWinSCP等で、修正しておいた必要なファイルをコピーするか
エディタで修正する


Fマウントをはずしてからshutdown

-----------------------------------------------------------------------------
root@pi-178:/# umount /dev/usb
root@pi-178:/#shutdown -h now

G修正したSDカードでbootし確認する