Linux 掛載有LVM的硬盤過程

有兩臺linux,其中一臺壞了,然後我將壞掉這臺機器的硬盤掛到另外一臺機器上了,我希望看到壞了這臺機器的/tmp目錄下的文件。


整個過程如下:

ogin as: root

[email protected]'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]#


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章