问题
root@xx:/opt/gopath/src/github.com/hyperledger/fabric# mkdir -p testtt
mkdir: cannot create directory ‘testtt’: Read-only file system
分析
可能是异常关机导致文件系统出现问题。
解决
1、查看机器的文件系统类型:
root@xxx:/opt/gopath/src/github.com/hyperledger/fabric# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 799M 8.6M 790M 2% /run
/dev/vda1 68G 15G 54G 22% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 799M 0 799M 0% /run/user/1000
root@xxx:/opt/gopath/src/github.com/hyperledger/fabric# parted /dev/vda1
GNU Parted 3.2
Using /dev/vda1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print list
Model: Virtio Block Device (virtblk)
Disk /dev/vda1: 75.2GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 75.2GB 75.2GB ext4
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 75.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 75.2GB 75.2GB primary ext4 boot
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 2147MB 2147MB fat32
由以上信息可知:根目录挂载在/dev/vda1分区,为ext4文件系统
2、修复
root@yangwl:/opt/gopath/src/github.com/hyperledger/fabric# fsck.ext4 -y /dev/vda1
e2fsck 1.42.13 (17-May-2015)
cloudimg-rootfs contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 4258 has zero dtime. Fix? yes
Inodes that were part of a corrupted orphan linked list found. Fix? yes
Inode 4618653 was part of the orphaned inode list. FIXED.
Inode 4618654 was part of the orphaned inode list. FIXED.
Inode 4618655 was part of the orphaned inode list. FIXED.
Inode 4618656 was part of the orphaned inode list. FIXED.
Inode 4618657 was part of the orphaned inode list. FIXED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(70411--70529)
Fix? yes
Free blocks count wrong for group #2 (4036, counted=4155).
Fix? yes
Free blocks count wrong (14035643, counted=14035762).
Fix? yes
Inode bitmap differences: -4258 -(4618653--4618657)
Fix? yes
Free inodes count wrong for group #0 (206, counted=207).
Fix? yes
Free inodes count wrong for group #288 (5293, counted=5298).
Fix? yes
Free inodes count wrong (8666335, counted=8666341).
Fix? yes
cloudimg-rootfs: ***** FILE SYSTEM WAS MODIFIED *****
cloudimg-rootfs: ***** REBOOT LINUX *****
cloudimg-rootfs: 293659/8960000 files (0.1% non-contiguous), 4314057/18349819 blocks
root@yangwl:/opt/gopath/src/github.com/hyperledger/fabric#
root@yangwl:/opt/gopath/src/github.com/hyperledger/fabric#
root@yangwl:/opt/gopath/src/github.com/hyperledger/fabric#
root@yangwl:/opt/gopath/src/github.com/hyperledger/fabric#
root@yangwl:/opt/gopath/src/github.com/hyperledger/fabric# reboot
Connection to 192.168.9.95 closed by remote host.
Connection to 192.168.9.95 closed.
gds@~$ ssh ubuntu@192.168.9.95
ssh: connect to host 192.168.9.95 port 22: Network is unreachable
gds@~$ ssh ubuntu@192.168.9.95
ssh: connect to host 192.168.9.95 port 22: Network is unreachable
gds@~$ ssh ubuntu@192.168.9.95
ssh: connect to host 192.168.9.95 port 22: Network is unreachable
gds@~$ ping 192.168.9.95
PING 192.168.9.95 (192.168.9.95): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
^C
--- 192.168.9.95 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
gds@~$ ping 192.168.9.95
PING 192.168.9.95 (192.168.9.95): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
^C
--- 192.168.9.95 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
gds@~$ ping 192.168.9.95
PING 192.168.9.95 (192.168.9.95): 56 data bytes
64 bytes from 192.168.9.95: icmp_seq=0 ttl=63 time=2.056 ms
64 bytes from 192.168.9.95: icmp_seq=1 ttl=63 time=2.494 ms
^C
--- 192.168.9.95 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 2.056/2.275/2.494/0.219 ms
gds@~$ ssh ubuntu@192.168.9.95
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-116-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
89 packages can be updated.
0 updates are security updates.
Last login: Mon Mar 5 02:44:09 2018 from 192.168.9.193
然后重启即可。