Partitioning Mount Hard Drive – How to Read/Mount Full Ubuntu Volume from External Hard Drive

hard drivelvmmountpartitioningssd

Yesterday I decided to upgrade my laptop hard drive to an SSD. I was previously running Ubuntu 14.04 on the HDD that came with it. I have installed Ubuntu 14.10 on the SSD.

I would like to mount the old HDD so that I can copy over all my files. So I purchased an enclosure that lets me treat it like an external USB drive. I put the HDD into the enclosure and plugged it in. It is detected and it sees all of the volumes. But it only mounts the boot volume for read/write.

The HDD is 750GB and the SSD is 120GB. When I inspect it in the "Disks" utility I see both hard drives and can easily tell the difference between the two. When I inspect the HDD I see: Partition 1 Ext2 (boot volume), Extended Partition 2, and Partition 5 LVM2 PV.

So clearly it can see the volumes as well. It reports that the disk is ok but has one bad sector. The drive is not encrypted. I am not sure why it shows two volumes of the same size. Probably has to do with it being an LVM volume.

How do I get it to let me read the files from my old installation of Ubuntu?

$ sudo fdisk -l
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7f79a18e

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sda1  *      2048    499711    497664   243M 83 Linux
/dev/sda2       501758 468860927 468359170 223.3G  5 Extended
/dev/sda5       501760 468860927 468359168 223.3G 8e Linux LVM

Disk /dev/mapper/ubuntu--vg-root: 215.6 GiB, 231479443456 bytes, 452108288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/ubuntu--vg-swap_1: 7.8 GiB, 8317304832 bytes, 16244736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 596.2 GiB, 640135028736 bytes, 1250263728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0004f632

Device     Boot  Start        End    Sectors  Size Id Type
/dev/sdb1  *      2048     499711     497664  243M 83 Linux
/dev/sdb2       501758 1250263039 1249761282  596G  5 Extended
/dev/sdb5       501760 1250263039 1249761280  596G 8e Linux LVM

Best Answer

You have to mount the LVM partition. It can be confusing if the physical volumes and/or logical volumes have the same name ...

Scan your system for LVM volumes and identify in the output the volume

sudo vgscan

you will see something like

Found volume group "fedora" using metadata type lvm2

You should see two volume groups

activate the (old) volumegroup

sudo vgchange -ay fedora

change "fedora" to your volume group ;)

Find the logical volume / partition that has your old ubuntu install

sudo lvs

or

sudo lvdisplay

or

ls /dev/fedora

again, change fedora to your volume group name

Mount the logical volumes

sudo mount /dev/fedora/home /mnt

and on ....

There is only one graphical too I know of, system-config-lvm

sudo apt-get install system-config-lvm
sudo system-config-lvm
Related Question