mount: block device /dev/sdb1 is write-protected, mounting read-only

  • Thread starter Thread starter cirroz
  • Start date Start date
C

cirroz

Guest
When open-iscsi first lost the target and then found it the system marks /var/lib/vz as write protected.
How to remount in rw-mode it without rebooting?

Code:
# mount | grep var
/dev/sdb1 on /var/lib/vz type ext3 (rw,_netdev)


# mount -o remount,rw /dev/sdb1
mount: block device /dev/sdb1 is write-protected, mounting read-only
 
I see, but when I try to touch any file inside /var/lib/vz it says to me read only, write-protected.
And all OpenVZ containers are frozen.
 
Last edited by a moderator:
I stopped open-iscsi:

Code:
[B]proxve:~# /etc/init.d/open-iscsi stop[/B]
Disconnecting iSCSI targets:.
Stopping iSCSI initiator service:.
[B]proxve:~# mount | grep vz[/B]

/dev/mapper/pve-data on /var/lib/vz1 type ext3 (rw)
/dev/sdb1 on /var/lib/vz type ext3 (rw,_netdev)
beancounter on /proc/vz/beancounter type cgroup (rw,name=beancounter)
container on /proc/vz/container type cgroup (rw,name=container)
fairsched on /proc/vz/fairsched type cgroup (rw,name=fairsched)
[B]proxve:~# ls -la /var/lib/vz/[/B]
ls: reading directory /var/lib/vz/: Input/output error
total 0
[B]proxve:~# [/B]

Started it:

Code:
[B]proxve:~# /etc/init.d/open-iscsi start[/B]
Starting iSCSI initiator service: iscsid.
Setting up iSCSI targets:
Logging in to [iface: default, target: iqn.1986-03.com.sun:02:05aceccf-49c3-e35c-a1a1-b31778f7d162, portal: 192.168.10.1,3260]
Login to [iface: default, target: iqn.1986-03.com.sun:02:05aceccf-49c3-e35c-a1a1-b31778f7d162, portal: 192.168.10.1,3260]: successful
.
Mounting network filesystems:.
[B]proxve:~# ls -la /var/lib/vz/[/B]
ls: reading directory /var/lib/vz/: Input/output error
total 0
[B]proxve:~# mount | grep vz[/B]
/dev/mapper/pve-data on /var/lib/vz1 type ext3 (rw)
/dev/sdb1 on /var/lib/vz type ext3 (rw,_netdev)
beancounter on /proc/vz/beancounter type cgroup (rw,name=beancounter)
container on /proc/vz/container type cgroup (rw,name=container)
fairsched on /proc/vz/fairsched type cgroup (rw,name=fairsched)

Trying to remount:

Code:
[B]proxve:~# mount -o remount,rw /var/lib/vz[/B]
[B]proxve:~# ls -la /var/lib/vz/[/B]
ls: reading directory /var/lib/vz/: Input/output error
total 0
[B]proxve:~# mount -o remount,rw /dev/sdb1[/B]
[B]proxve:~# ls -la /var/lib/vz/[/B]
ls: reading directory /var/lib/vz/: Input/output error
total 0
[B]proxve:~# umount /var/lib/vz[/B]
umount: /var/lib/vz: device is busy
umount: /var/lib/vz: device is busy
[B]proxve:~# umount -f /var/lib/vz[/B]
umount2: Device or resource busy
umount: /var/lib/vz: device is busy
umount2: Device or resource busy
umount: /var/lib/vz: device is busy
[B]proxve:~# mount | grep vz[/B]
/dev/mapper/pve-data on /var/lib/vz1 type ext3 (rw)
/dev/sdb1 on /var/lib/vz type ext3 (rw,_netdev)
beancounter on /proc/vz/beancounter type cgroup (rw,name=beancounter)
container on /proc/vz/container type cgroup (rw,name=container)
fairsched on /proc/vz/fairsched type cgroup (rw,name=fairsched)
[B]proxve:~# /etc/init.d/open-iscsi status [/B]
Current active iSCSI sessions:
tcp: [2] 192.168.10.1:3260,1 iqn.1986-03.com.sun:02:05aceccf-49c3-e35c-a1a1-b31778f7d162
[B]proxve:~# grep startup /etc/iscsi/nodes/iqn.1986-03.com.sun\:02\:05aceccf-49c3-e35c-a1a1-b31778f7d162/192.168.10.1\,3260\,1/default[/B]
node.startup = automatic
node.conn[0].startup = automatic
[B]proxve:~# [/B]

Looks like /var/lib/vz didn't unmounted properly when I stopped open-iscsi.
Is it a bug in open-iscsi?
 
Last edited by a moderator:
...
Looks like /var/lib/vz didn't unmounted properly when I stopped open-iscsi.
Is it a bug in open-iscsi?
Hi,
no it's an User-bug. If you unplugged an hdd, you should also umount all filesystem from this disk before. With iscsi it's the same. And stopping iscsi is the "pwer off" method, if you tried to logout to the iscsi-session you will get an messages, that the session is still in use?!

Udo
 
Look.
If open-iscsi loses connection to target for any reason I can't repair it other than restart whole OS.
Or do you know how to fix open-iscsi connections and do not restart PVE?

Regards,
Anton.