Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Assumptions:
- Linux software RAID1
- /dev/md0 = /dev/sdb1 + /dev/sdc1
- /dev/md0 mount point /data
- no spare disk
It is very easy to replace fail disk of the array when the system is up and running. Lets say disk /dev/sdc fail. A few steps need to be done to replace a disk:
Code:
mark bad disk:
# mdadm --manage /dev/md0 --fail /dev/sdc1
remove bad disk:
# mdadm --manage /dev/md0 --remove /dev/sdc1
reboot and replace bad diskcopy a disk layout for a new disk
# sfdisk -d /dev/sdb | sfdisk /dev/sdc
add a new disk to array and wait for resynchronization
# mdadm --manage /dev/md0 --add /dev/sdc1
Done
But, lets say we have a situation where one of disk fail and just after this machine has a power failure.
When it starts again there is no way to use /dev/md0 again and it means that all files at file system /data are not available.
In the scenario you proposed, the system will start with md0 in degraded mode following the fsck during initialization. You can then replace the failed drive as usual.
I have just tried to use fsck. I dont really how can it helps ?
Please, have a look at output:
Note - I have changed scenerio. In fact fail disk is /dev/sdc
Code:
root@cslack:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md0 : inactive sdb1[2](S)
203648 blocks super 1.2
unused devices: <none>
root@cslack:~# fsck -t ext4 /dev/md0
fsck from util-linux 2.21.2
e2fsck 1.42.5 (29-Jul-2012)
/sbin/e2fsck: Invalid argument while trying to open /dev/md0
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
root@cslack:~# e2fsck -b 8193 /dev/md0
e2fsck 1.42.5 (29-Jul-2012)
e2fsck: Invalid argument while trying to open /dev/md0
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
root@cslack:~# mdadm -S /dev/md0
mdadm: stopped /dev/md0
root@cslack:~# mdadm --assemble --scan --run
root@cslack:~# fsck.ext4 /dev/sdb1
e2fsck 1.42.5 (29-Jul-2012)
ext2fs_open2: Bad magic number in super-block
/sbin/e2fsck: Superblock invalid, trying backup blocks...
/sbin/e2fsck: Bad magic number in super-block while trying to open /dev/sdb1
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
root@cslack:~# e2fsck -b 8193 /dev/sdb1
e2fsck 1.42.5 (29-Jul-2012)
e2fsck: Invalid argument while trying to open /dev/sdb1
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
I have just tried to simply mount disk to see is there are any data yet... no luck
Code:
root@cslack:~# mount /dev/sdb1 /mnt/tmp/
NTFS signature is missing.
Failed to mount '/dev/sdb1': Invalid argument
The device '/dev/sdb1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.