Recovery after Linux soft RAID goes offline

Source: Internet
Author: User

If the machine has data, you must be very careful when operating. The internal samba server cannot be accessed, and there is nothing in/share. No data is found. Later, I checked it carefully and found that the machine had five hard disks, which seemed to be a soft raid.

1. Run the fdisk-l command to view and find

/Dev/sde1 1 60801 488384001 fd Linux raid autodete

2. cat/proc/mdstat, md0, and md1 are all inactive.

3. I 've taken it all offline for a long time. I am afraid to perform too many operations because of the data. It doesn't matter if I want to re-establish it.

Disable raid: mdadm-Ss and then start raid: mdadm-

Cat/etc/mdadm. conf

DEVICE/dev/sdb1/dev/sdc1/dev/sdd1/dev/sde1/dev/md0/dev/md1
ARRAY/dev/md0 metadata = 1.2 name = file: 0 UUID = 4bd3bbbb: 57305692: 6d264713: 10028518
ARRAY/dev/md1 metadata = 1.2 name = file: 1 UUID = rjd94c6: 7d7754a0: f91a4e70: acfdc372
ARRAY/dev/md2 metadata = 1.2 name = file: 2 UUID = 6662ae21: aa253ded: 46ea5e25: 9a4559a4

4. fdisk-l

Disk/dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0xd87fd87f

Device Boot Start End Blocks Id System
/Dev/sdb1 1 38913 312568641 fd Linux raid autodetect

Disk/dev/sdc: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x3a563a56

Device Boot Start End Blocks Id System
/Dev/sdc1 1 38913 312568641 fd Linux raid autodetect

Disk/dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/4096 bytes
I/O size (minimum/optimal): 4096 bytes/4096 bytes
Disk identifier: 0x9fd1c6eb

Device Boot Start End Blocks Id System
/Dev/sdd1 1 60801 488384001 fd Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk/dev/sde: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/4096 bytes
I/O size (minimum/optimal): 4096 bytes/4096 bytes
Disk identifier: 0xe0150a6e

Device Boot Start End Blocks Id System
/Dev/sde1 1 60801 488384001 fd Linux raid autodetect
Partition 1 does not start on physical sector boundary.

 

Disk/dev/md0: 319.9 GB, 319935873024 bytes
2 heads, 4 sectors/track, 78109344 cylinders
Units = cylinders of 8*512 = 4096 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0xddd48bce

Disk/dev/md0 doesn't contain a valid partition table

Disk/dev/md1: 500.0 GB, 499970801664 bytes
2 heads, 4 sectors/track, 122063184 cylinders
Units = cylinders of 8*512 = 4096 bytes
Sector size (logical/physical): 512 bytes/4096 bytes
I/O size (minimum/optimal): 4096 bytes/4096 bytes
Alignment offset: 512 bytes
Disk identifier: 0x00000000

Disk/dev/md1 doesn't contain a valid partition table

Disk/dev/md2: 819.9 GB, 819906215936 bytes
2 heads, 4 sectors/track, 200172416 cylinders
Units = cylinders of 8*512 = 4096 bytes
Sector size (logical/physical): 512 bytes/4096 bytes
I/O size (minimum/optimal): 524288 bytes/1048576 bytes
Alignment offset: 512 bytes
Disk identifier: 0xe6aa9a8f

Device Boot Start End Blocks Id System
/Dev/md2p1 129 200172416 800689152 8e Linux LVM
Partition 1 does not start on physical sector boundary.

 

5. mdadm -- detail/dev/md0
/Dev/md0:
Version: 1.2
Creation Time: Tue Mar 26 00:10:39 2013
Raid Level: raid1
Array Size: 312437376 (297.96 GiB 319.94 GB)
Used Dev Size: 312437376 (297.96 GiB 319.94 GB)
Raid Devices: 2
Total Devices: 2
Persistence: Superblock is persistent

Update Time: Thu Apr 3 22:43:39 2014
State: clean
Active Devices: 2
Working Devices: 2
Failed Devices: 0
Spare Devices: 0

Name: file: 0 (local to host file)
UUID: 4bd3bbbb: 57305692: 6d264713: 10028518
Events: 16408

Number Major Minor RaidDevice State
0 8 17 0 active sync/dev/sdb1
2 8 33 1 active sync/dev/sdc1

 

Two Disks are used as RAID 1, and md0 and md1 are used as RAID 0.

6. After reading the above output, there is a usage, indicating that the data is still there, just a little bit

Mount/dev/md2p1/share directly, and the following message is displayed: mount: unknown filesystem type 'lvm2 _ Member'

Solution:

--- Logical volume ---
LV Name/dev/vgmd2/lvshare
VG Name vgmd2
Lvuuid hN0kGI-5yBU-3ABH-rkU2-fPGi-JfX8-D1C0DQ
LV Write Access read/write
LV Status NOT available
LV Size 256.00 GiB
Current LE 16384
Segments 1
Allocation inherit
Read ahead sectors auto

--- Logical volume ---
LV Name/dev/vgmd2/lvnfs
VG Name vgmd2
Lvuuid PRKkOr-zzJd-O0di-GT8W-0lsf-wtN3-1bFShN
LV Write Access read/write
LV Status NOT available
LV Size 10.00 GiB
Current LE 640
Segments 1
Allocation inherit
Read ahead sectors auto

After vgchange-ay, lvdisplay

--- Logical volume ---
LV Name/dev/vgmd2/lvshare
VG Name vgmd2
Lvuuid hN0kGI-5yBU-3ABH-rkU2-fPGi-JfX8-D1C0DQ
LV Write Access read/write
LV Status available
# Open 0
LV Size 256.00 GiB
Current LE 16384
Segments 1
Allocation inherit
Read ahead sectors auto
-Currently sets to 4096
Block device 254: 4

--- Logical volume ---
LV Name/dev/vgmd2/lvnfs
VG Name vgmd2
Lvuuid PRKkOr-zzJd-O0di-GT8W-0lsf-wtN3-1bFShN
LV Write Access read/write
LV Status available
# Open 0
LV Size 10.00 GiB
Current LE 640
Segments 1
Allocation inherit
Read ahead sectors auto
-Currently sets to 4096
Block device 254: 5

Mount-t ext4/dev/vgmd2/lvshare/share

7. log in with the samba username and password. You can go in without prompting that you have no permission error. Be careful when performing this operation.

Finally Write/etc/fstab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.