WD MyCloud 在通过SSH 进入命令行的时候误操作,导致系统彻底完蛋,查找了很长时间,找到了解决方法。
- 对于彻底完蛋了的系统,比如,已经无法进入系统了,不管是SSH 还是网页,总之就是系统动不了。 则参考如下操作:(注意本方法会导致数据被彻底删除,使用时候要慎重)
1.从http://pan.baidu.com/s/1eQBVbc2 下载3TB 版本的系统恢复镜像。
2.拆开机器,系统出厂自带的是Debian linux系统,重装系统需要将外壳拿掉,将硬盘取出。外壳是通过卡扣连接主体的,拆的时候有可能会折断卡扣,但不会影响重装回去之后的外观。大致方法就是,找几张废旧电话卡或银行卡从机子的后背也就是网卡口的左右两侧的外壳缝隙插进去,稍微撬开一点缝隙,保持卡片不动,然后将外壳用巧力使劲往 前推,慢慢的推出去,即可把外壳拆下。硬盘和壳子通过4个胶垫固定,先抬起硬盘一侧,使得两个胶垫脱离壳子,然后再慢慢向上和向外取出即可,过程没什么技 术含量,只需要小心一点就是了。连接主板和硬盘有4颗螺丝,其中一颗在led灯胶垫下,掰开胶垫可见,一并拧下。
3.把硬盘挂载到一台Linux的机器,推荐使用 Ubuntu ,本机使用的是 Ubuntu 13.10 .挂载的时候,可以使用USB 或者 ESATA接口的移动硬盘盒即可。
4.建议删除原始磁盘上的所有分区
1 2 3 4 5 6 7 8 9 10 11 12 |
root@y-System-Product-Name:/# parted GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) select /dev/sdb Using /dev/sdb (parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? y (parted) quit Information: You may need to update /etc/fstab. |
5.使用 如下命令强制还原镜像到硬盘,假定此时硬盘被挂载到了 /dev/sdb上
1 |
$ sudo dd if=/mnt/usb/MyCloud3TB.img of=/dev/sdb bs=1M |
6.装回硬盘到 WD My Cloud ,(注意此时不要用Linux 自带的gparted 操作硬盘,否则会导致无法启动),然后开启 SSH ,在命令行中执行 parted 命令,此时,会提示分区存在问题,按照提示修复即可。尽量在My Cloud 里面执行脚本命令,外面的Linux 执行命令的话,经常导致无法启动问题,最好在My Cloud 里面执行一下 e2fsck 来检查一下磁盘,尤其是最后的数据分区,恢复的时候一般都会有分区表错误,貌似只有在SSH 里面执行的才是正常的,原因未知。至于下面的分区大小调整,如果能在SSH 中处理的话,是最好的,问题最少。 下面是SSH 处理的SHELL 记录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
WDMyCloud:~# df Filesystem 1K-blocks Used Available Use% Mounted on rootfs 1968336 482148 1386200 26% / /dev/root 1968336 482148 1386200 26% / tmpfs 23056 336 22720 2% /run tmpfs 40960 4 40956 1% /run/lock tmpfs 10240 0 10240 0% /dev tmpfs 5120 0 5120 0% /run/shm tmpfs 102400 196 102204 1% /tmp /dev/root 1968336 482148 1386200 26% /var/log.hdd ramlog-tmpfs 20480 1988 18492 10% /var/log /dev/sda4 2879644604 594272 2820539292 1% /DataVolume /dev/root 1968336 482148 1386200 26% /nfs/Public /dev/root 1968336 482148 1386200 26% /nfs/SmartWare /dev/root 1968336 482148 1386200 26% /nfs/TimeMachineBackup WDMyCloud:~# umount /dev/sda4 WDMyCloud:~# umount /dev/root WDMyCloud:~# umount /dev/root WDMyCloud:~# umount /dev/root WDMyCloud:~# umount /dev/root WDMyCloud:~# df Filesystem 1K-blocks Used Available Use% Mounted on rootfs 1968336 482148 1386200 26% / /dev/root 1968336 482148 1386200 26% / tmpfs 23056 336 22720 2% /run tmpfs 40960 4 40956 1% /run/lock tmpfs 10240 0 10240 0% /dev tmpfs 5120 0 5120 0% /run/shm tmpfs 102400 196 102204 1% /tmp ramlog-tmpfs 20480 1988 18492 10% /var/log WDMyCloud:~# e2fsck /dev/sda4 e2fsck 1.42.5 (29-Jul-2012) /dev/sda4 contains a file system with errors, check forced. Pass 1: Checking inodes, blocks, and sizes Journal inode is not in use, but contains data. Clear<y>? yes Pass 2: Checking directory structure Entry 'cache' in / (2) has deleted/unused inode 92798977. Clear<y>? yes Entry 'shares' in / (2) has deleted/unused inode 51642369. Clear<y>? yes Entry 'backup' in / (2) has deleted/unused inode 28049409. Clear<y>? yes Pass 3: Checking directory connectivity Pass 4: Checking reference counts Inode 2 ref count is 6, should be 3. Fix<y>? yes Pass 5: Checking group summary information Block bitmap differences: -(33808--33814) -(34304--64646) -(65536--98303) -(100352--163839) -(165888--229375) -(231424--294911) -(296960--524287) -(57679904--57679911) -(68165664--68165676) -(68165680--68165687) -518004768 Fix<y>? yes Free blocks count wrong for group #1 (1393, counted=31743). Fix<y>? yes Free blocks count wrong for group #2 (0, counted=32768). Fix<y>? yes Free blocks count wrong for group #3 (1023, counted=31743). Fix<y>? yes Free blocks count wrong for group #4 (29696, counted=32768). Fix<y>? yes Free blocks count wrong for group #3424 (24543, counted=24544). Fix<y>? yes Free blocks count wrong for group #6304 (24526, counted=24544). Fix<y>? yes Free blocks count wrong for group #6305 (32754, counted=32768). Fix<y>? yes Free blocks count wrong for group #7425 (0, counted=32768). Fix<y>? yes Free blocks count wrong for group #11328 (24513, counted=24544). Fix<y>? yes Free blocks count wrong for group #11329 (32626, counted=32768). Fix<y>? yes Free blocks count wrong (719762583, counted=719892467). Fix<y>? yes Free inodes count wrong for group #3424 (8191, counted=8192). Fix<y>? yes Directories count wrong for group #3424 (1, counted=0). Fix<y>? yes Free inodes count wrong for group #6304 (8174, counted=8192). Fix<y>? yes Directories count wrong for group #6304 (15, counted=0). Fix<y>? yes Free inodes count wrong for group #11328 (8084, counted=8192). Fix<y>? yes Directories count wrong for group #11328 (31, counted=0). Fix<y>? yes Free inodes count wrong (182853494, counted=182853621). Fix<y>? yes /dev/sda4: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sda4: 11/182853632 files (0.0% non-contiguous), 11495550/731388017 blocks WDMyCloud:~# parted GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used. OK/Cancel? OK Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 1953504000 blocks) or continue with the current setting? Fix/Ignore? Fix Model: ATA WDC WD40EFRX-68W (scsi) Disk /dev/sda: 4001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 3 15.7MB 528MB 513MB linux-swap(v1) primary 1 528MB 2576MB 2048MB ext3 primary raid 2 2576MB 4624MB 2048MB ext3 primary raid 5 4624MB 4724MB 99.6MB primary 6 4724MB 4824MB 101MB primary 7 4824MB 4826MB 1049kB primary 8 4826MB 4828MB 2097kB primary 4 4828MB 3001GB 2996GB ext4 primary (parted) unit Unit? [compact]? s (parted) p Model: ATA WDC WD40EFRX-68W (scsi) Disk /dev/sda: 7814037168s Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 3 30720s 1032191s 1001472s linux-swap(v1) primary 1 1032192s 5031935s 3999744s ext3 primary raid 2 5031936s 9031679s 3999744s ext3 primary raid 5 9031680s 9226239s 194560s primary 6 9226240s 9422847s 196608s primary 7 9422848s 9424895s 2048s primary 8 9424896s 9428991s 4096s primary 4 9428992s 5860533134s 5851104143s ext4 primary (parted) rm 4 (parted) mkpart Partition name? []? File system type? [ext2]? ext4 Start? 9428992s # 开始扇区的是原来4号分区的开始扇区 End? 7814037167s # 终止扇区的是执行 p 命令时候返回的磁盘总扇区数7814037168s-1 (parted) q Information: You may need to update /etc/fstab. WDMyCloud:~# parted GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p Model: ATA WDC WD40EFRX-68W (scsi) Disk /dev/sda: 4001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 3 15.7MB 528MB 513MB linux-swap(v1) primary 1 528MB 2576MB 2048MB ext3 primary raid 2 2576MB 4624MB 2048MB ext3 primary raid 5 4624MB 4724MB 99.6MB primary 6 4724MB 4824MB 101MB primary 7 4824MB 4826MB 1049kB primary 8 4826MB 4828MB 2097kB primary 4 4828MB 3996GB 3991GB ext4 (parted) check 4 WARNING: you are attempting to use parted to operate on (check) a file system. parted's file system manipulation code is not as robust as what you'll find in dedicated, file-system-specific packages like e2fsprogs. We recommend you use parted only to manipulate partition tables, whenever possible. Support for performing most operations on most types of file systems will be removed in an upcoming release. Warning: Partition 4 is 3991GB, but the file system is 2996GB. Ignore/Cancel? Ignore Error: File system has an incompatible feature enabled. Compatible features are has_journal, dir_index, filetype, sparse_super and large_file. Use tune2fs or debugfs to remove features. (parted) q WDMyCloud:~# resize2fs /dev/sda4 resize2fs 1.42.5 (29-Jul-2012) Resizing the filesystem on /dev/sda4 to 974397394 (4k) blocks. The filesystem on /dev/sda4 is now 974397394 blocks long. WDMyCloud:~# reboot |
最好升级一下 usb 接口的程序版本,新版本貌似修正了大文件拷贝会死机的问题
1 2 3 |
$ sudo apt-get update $ sudo apt-get install udev |
7.再次拆卸硬盘,用Linux 中的 gparted 来根据实际硬盘的大小来调整硬盘,比如,我的是4T 版本的,刷完之后,会有1T 的空白分区,这个时候可以通过gparted 来调整到整个硬盘。 (注意,外面调整分区可能导致不能启动,原因未知,因此恐怕要多尝试几次)
8.装回硬盘,重新启动,最好恢复一下出厂设置。
- 如果分区都还在,又不想损坏数据,可以试试如下方法
1.下载最新的固件版本比如 http://download.wdc.com/nas/WDMyCloud-030104-139-2
2.按照上文方法拆卸硬盘,并挂载到Ubuntu。
3.在磁盘管理器中打开如下界面,还原到的分区为管理器中现实Raid 的两个分区中,两个分区逐个还原。
选择 "Restore Disk Image"
上面的方法有些人可以恢复成功,有些没有办法恢复成功,中间的差别一般在于有些人机器上安装了mdadm
。如下图所示,磁盘挂载后会识别出"2.0GB RAID-1阵列
",如果下面的挂载位置不是"/dev/md/0
",而是显示"/dev/md127
"或者"/dev/md126
",那么,即使什么都不操作,直接装回去,也可能发现WDMyCloud
不能正常启动了。
这个原因是由于机器上安装的mdadm
无意之间修改了部分内容,导致WDMyCloud
无法识别。解决办法是在电脑上重建这个"2.0GB RAID-1阵列
",以系统会把磁盘挂载到/dev/sdb
为例子,方法如下:
1 2 3 |
$ sudo mdadm --stop /dev/md0 $ sudo mdadm -C /dev/md0 --metadata=0.9 -l 1 -n 2 /dev/sdb1 /dev/sdb2 |
重建完成后,挂载位置被修正为"/dev/md/0
",然后通过在"2.0GB RAID-1阵列
"上点击"对分区映像恢复
"(英文应该是"Restore Disk Image
")进行镜像的恢复工作。
恢复完成后,先执行
1 |
$ sudo mdadm --stop /dev/md0 |
停止阵列,然后点击顶部的"Power Off
"按钮,移除磁盘。如下图:
上面的操作完成后,一般会出现磁盘错误,建议进行磁盘检查,具体操作过程如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
$ sudo umount /dev/sda4 $ sudo umount /dev/sda4 $ sudo umount /dev/sda4 #查看挂载的分区 $ df 文件系统 1K-块 已用 可用 已用% 挂载点 rootfs 1968336 744964 1123384 40% / /dev/root 1968336 744964 1123384 40% / tmpfs 40960 4160 36800 11% /run tmpfs 40960 64 40896 1% /run/lock tmpfs 10240 0 10240 0% /dev tmpfs 5120 0 5120 0% /run/shm tmpfs 102400 9280 93120 10% /tmp /dev/root 1968336 744964 1123384 40% /var/log.hdd ramlog-tmpfs 40960 6464 34496 16% /var/log /dev/sda4 3841069352 2937611696 825411592 79% /CacheVolume $ lsof | grep CacheVolume $ kill -9 $(pidof twonkystarter) $ kill -9 $(pidof twonkyserver) $ kill -9 $(pidof forked-daapd) $ sudo umount /dev/sda4 $ fsck -y /dev/sda4 |
上述操作完成后,如果首页容量部分一直显示0KB
,则参考WD MyCloud拆硬盘恢复系统后容量部分显示0KB。
参考链接
- http://community.wd.com/t5/WD-My-Cloud/How-to-unbrick-a-totally-dead-My-Cloud/td-p/651195/page/6
- http://community.wd.com/t5/My-Book-Live/GUIDE-How-to-unbrick-a-totally-dead-MBL/td-p/435724
- http://www.right.com.cn/forum/thread-110111-1-1.html
- http://community.wd.com/t5/WD-My-Cloud/How-to-unbrick-a-totally-dead-My-Cloud/m-p/652071#M3902
- http://community.wd.com/t5/My-Book-Live/GUIDE-Debrick-MyBookLive-v2-0/td-p/567582