May 26

I have 2 harddisk, the first hdd (80 GB) is an empty hdd that i have already installed with new ubuntu server and the other one is an old hdd(180 GB) consist of ubuntu with LVM system. And i am trying to add the oll hdd to my cpu. Here is the 2 hdd detail

# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 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: 0x000a4ac8

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        9328    74920960   83  Linux
/dev/sda2            9328        9730     3227649    5  Extended
/dev/sda5            9328        9730     3227648   82  Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0xe626e626

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       19426   156039313+  8e  Linux LVM
/dev/sdb2           19427       19457      249007+   5  Extended
/dev/sdb5           19427       19457      248976   83  Linux

As you can see the old hdd ( 160 GB) /dev/sdb1 have LINUX LVM , you need lvm2 so you can mount it, here is the step

#apt-get install lvm2

You need to use pvs command to determine the volume group containing the physical volume /dev/sdb1

# pvs

PV                VG        Fmt   Attr  PSize       PFree
/dev/sdb1   test        lvm2  a-    148.81g    0

You can see there are physical volume named test onsecond hdd /dev/sdb1

let’s list the logical volumes in physical volume named test

# lvdisplay
— Logical volume —
LV Name                /dev/test/root
VG Name                test
LV UUID                1bvHS8-07SA-WuAg-tF5q-eWB5-Lp8a-2cyteC
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                143.08 GiB
Current LE             36629
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           251:0

— Logical volume —
LV Name                /dev/test/swap_1
VG Name                test
LV UUID                Y6c4ge-sv5W-anJY-e4sH-dis8-a5Qi-rABjMO
LV Write Access        read/write
LV Status              available
# open                 0
LV Size                5.73 GiB
Current LE             1466
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           251:1

As you can see there are 2 lvm /dev/test/swap_1 and /dev/test/root that actual shortcut from /dev/mapper/test-swap_1 and /dev/mapper/test-root

Now you just need to mount the /dev/testroot to directory you wanted , let say /mnt/oldhdd

# mkdir /mnt/oldhdd

# mount /dev/test/root /mnt/oldhd/

you can see the mount now

df -ah
Filesystem                                         Size  Used Avail Use% Mounted on
/dev/mapper/test-root        141G   27G  108G  20% /mnt/oldhd