码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 挂载有LVM的硬盘过程

时间:2014-12-08 15:50:07      阅读:470      评论:0      收藏:0      [点我收藏+]

标签:linux ;lvm;数据恢复

有两台linux,其中一台坏了,然后我将坏掉这台机器的硬盘挂到另外一台机器上了,我希望看到坏了这台机器的/tmp目录下的文件。


整个过程如下:

ogin as: root

root@XX.XX.XX.XX‘s password:

Last login: Fri Dec  5 14:47:42 2014 from chengmanyu.asiapacific.cpqcorp.net


[root@localhost ~]# fdisk -l


Disk /dev/sda: 21.5 GB, 21474836480 bytes

64 heads, 32 sectors/track, 20480 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0003008c


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           2         501      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2             502       20480    20458496   8e  Linux LVM

Partition 2 does not end on cylinder boundary.


Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18832424960 bytes

255 heads, 63 sectors/track, 2289 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: 0x00000000



Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes

255 heads, 63 sectors/track, 257 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: 0x00000000



Disk /dev/sdb: 21.5 GB, 21474836480 bytes

64 heads, 32 sectors/track, 20480 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00042f63


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           2         501      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sdb2             502       20480    20458496   8e  Linux LVM

Partition 2 does not end on cylinder boundary.



[root@localhost ~]# vgdisplay

  WARNING: Duplicate VG name VolGroup: Existing 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6 (created here) takes precedence over Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9

  WARNING: Duplicate VG name VolGroup: Existing 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6 (created here) takes precedence over Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9

  WARNING: Duplicate VG name VolGroup: Existing Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9 (created here) takes precedence over 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6

  --- Volume group ---

  VG Name               VolGroup

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  3

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               19.51 GiB

  PE Size               4.00 MiB

  Total PE              4994

  Alloc PE / Size       4994 / 19.51 GiB

  Free  PE / Size       0 / 0

  VG UUID               Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9


  WARNING: Duplicate VG name VolGroup: Existing 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6 (created here) takes precedence over Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9

  --- Volume group ---

  VG Name               VolGroup

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  5

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               19.51 GiB

  PE Size               4.00 MiB

  Total PE              4994

  Alloc PE / Size       4994 / 19.51 GiB

  Free  PE / Size       0 / 0

  VG UUID               4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6



[root@localhost ~]# vgrename Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9 VolGroup1

  WARNING: Duplicate VG name VolGroup: Existing 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6 (created here) takes precedence over Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9

  WARNING: Duplicate VG name VolGroup: Existing 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6 (created here) takes precedence over Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9

  WARNING: Duplicate VG name VolGroup: Existing Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9 (created here) takes precedence over 4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6

  Volume group "VolGroup" successfully renamed to "VolGroup1"

[root@localhost ~]# lvscan

  inactive          ‘/dev/VolGroup1/lv_root‘ [17.54 GiB] inherit

  inactive          ‘/dev/VolGroup1/lv_swap‘ [1.97 GiB] inherit

  ACTIVE            ‘/dev/VolGroup/lv_root‘ [17.54 GiB] inherit

  ACTIVE            ‘/dev/VolGroup/lv_swap‘ [1.97 GiB] inherit


[root@localhost ~]# vgdisplay

  --- Volume group ---

  VG Name               VolGroup1

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  4

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               19.51 GiB

  PE Size               4.00 MiB

  Total PE              4994

  Alloc PE / Size       4994 / 19.51 GiB

  Free  PE / Size       0 / 0

  VG UUID               Y5536Q-Kcui-bjhl-S6Oz-DaUq-f5Of-jaM3r9


  --- Volume group ---

  VG Name               VolGroup

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  5

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               19.51 GiB

  PE Size               4.00 MiB

  Total PE              4994

  Alloc PE / Size       4994 / 19.51 GiB

  Free  PE / Size       0 / 0

  VG UUID               4zNT0y-RPZo-tExT-E1Io-vtT8-BuPa-H23BR6


[root@localhost ~]# vgchange -a y /dev/VolGroup1

  2 logical volume(s) in volume group "VolGroup1" now active

[root@localhost ~]# lvscan

  ACTIVE            ‘/dev/VolGroup1/lv_root‘ [17.54 GiB] inherit

  ACTIVE            ‘/dev/VolGroup1/lv_swap‘ [1.97 GiB] inherit

  ACTIVE            ‘/dev/VolGroup/lv_root‘ [17.54 GiB] inherit

  ACTIVE            ‘/dev/VolGroup/lv_swap‘ [1.97 GiB] inherit



[root@localhost ~]# mount /dev/VolGroup1/lv_root /mnt

[root@localhost ~]# cd /mnt

[root@localhost mnt]# ls

admintools  cgroup  home   lost+found  net   root     srv  user

bin         dev     lib    media       opt   sbin     sys  usr

boot        etc     lib64  misc        proc  selinux  tmp  var

[root@localhost mnt]# cd ./tmp/

[root@localhost tmp]# ls

cim_schema.eiTNW    pulse-RppuNjTCVDM1   vmware-root

orbit-gdm           sendmail.cf          VMwareTools-8.3.12-493255.tar.gz

passwd              sendmail.cf.1        vmware-tools-distrib

passwd.tmp          test.txt             yum.log

passwd.tmp.1        virtual-root.VYrCzD

pulse-Msfyk93SgAX9  vmware-config0

[root@localhost tmp]#


本文出自 “盛满鱼” 博客,请务必保留此出处http://chengmanyu.blog.51cto.com/7198694/1587517

Linux 挂载有LVM的硬盘过程

标签:linux ;lvm;数据恢复

原文地址:http://chengmanyu.blog.51cto.com/7198694/1587517

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!