Centos机器损坏之硬盘迁移

  • A+
所属分类:Linux

前几天公司的一个Linux主机损坏了,为了不影响公司项目的正常运行,我把硬盘直接插到别的主机上。启动系统,发现又好几个驱动都没有,最主要的网卡驱动安装了半天也安装不上去。只好先把硬盘的数据迁移到另一个Linux主机上。

1.先创建临时挂载目录
# mkdir /mnt/bk
2.查看硬盘信息
# 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: 0x786c786c

 Device Boot Start End Blocks Id System
/dev/sdb1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sdb2 64 38914 312057856 8e Linux LVM

Disk /dev/sda: 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: 0x33c546ec

 Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 587 4194304 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 587 38914 307863552 83 Linux

如果磁盘分区是Linux可直接挂载这个分区
mount /dev/sda3 /mnt/bk
如果磁盘分区是Linux LVM直接挂载会报mount: unknown filesystem type 'LVM2_member'
解决方法:yum install lvm2 -y
3.查看物理卷
[root@localhost mnt]# pvs
 PV VG Fmt Attr PSize PFree
 /dev/sdb2 vg_dppctest lvm2 a--u 297.60g 0 
4.查看卷组
[root@localhost mnt]# vgs
 VG #PV #LV #SN Attr VSize VFree
 vg_dppctest 1 3 0 wz--n- 297.60g 0 
5.查看逻辑卷
[root@localhost mnt]# lvdisplay
 --- Logical volume ---
 LV Path /dev/vg_dppctest/lv_root
 LV Name lv_root
 VG Name vg_dppctest
 LV UUID mLUuCd-V665-yQV0-sWIW-W28N-5O5R-e1ikkB
 LV Write Access read/write
 LV Creation host, time dppcTest, 2014-08-08 22:52:07 +0800
 LV Status NOT available
 LV Size 50.00 GiB
 Current LE 12800
 Segments 1
 Allocation inherit
 Read ahead sectors auto
 
 --- Logical volume ---
 LV Path /dev/vg_dppctest/lv_home
 LV Name lv_home
 VG Name vg_dppctest
 LV UUID 2ECyiG-Ysdh-jese-hLtV-wETB-XQxq-FdeSKO
 LV Write Access read/write
 LV Creation host, time dppcTest, 2014-08-08 22:52:18 +0800
 LV Status NOT available
 LV Size 243.72 GiB
 Current LE 62393
 Segments 1
 Allocation inherit
 Read ahead sectors auto
 
 --- Logical volume ---
 LV Path /dev/vg_dppctest/lv_swap
 LV Name lv_swap
 VG Name vg_dppctest
 LV UUID OjBLkt-rsBx-NhYp-cOZc-XsOi-gey5-OcfKOm
 LV Write Access read/write
 LV Creation host, time dppcTest, 2014-08-08 22:53:13 +0800
 LV Status NOT available
 LV Size 3.88 GiB
 Current LE 992
 Segments 1
 Allocation inherit
 Read ahead sectors auto

查看逻辑卷状态 LV Status NOT available,如果未激活需要激活一下,激活命令
[root@localhost mnt]# vgchange -ay /dev/vg_dppctest
3 logical volume(s) in volume group "vg_dppctest" now active
6.挂载逻辑卷
# mount /dev/vg_dppctest/lv_home /mnt/bk

OK,现在就可以进/mnt/bk下查看之前硬盘的数据了!











 

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: