4

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
1
  • Was that disk part of a RAID volume??? Can you also provide the output of: sudo fdisk -l
    – Fabby
    Nov 16, 2014 at 23:11

4 Answers 4

3

I had this issue and found a solution from this Ubuntu Forums Thread. I will give further details in case others have this issue and/or that link goes dead in the future.

System Details

Running Ubuntu 16.04 on primary. I have 2 internal drives (SDA = Ubuntu 16.04 with Grub, SDB = Windows 10). I also had an internal SATA drive with Ubuntu 14.04 from a different machine which I decided to mount using an SATA-to-USB external dock, which subsequently placed this disk at SDC; I will refer to this drive as "delta" (view these with sudo lsblk or sudo fdisk -l, or optionally launch GUI "Disks" from Dash)

Issues

Simply looking in Nautilus (Files GUI) I can see a 255 MB Volume when the delta drive is connected, however this is the Partition 1 Master Boot Record (Linux Bootable; EXT2). Looking in Disks GUI it is clear I have an Extended Partition (partition2) of 1,000 GB and Partition5 which is 1,000 GB LVM2 Physical Volume, but no option to mount this partition.

Fix

  • First run

    $ sudo vgscan
    Reading all physical volumes.  This may take a while...
    Found volume group "ubuntu-vg" using metadata type lvm2
    Found volume group "ubuntu-vg" using metadata type lvm2
    

    The issue with this output is that both my primary drive and this secondary "delta" drive are showing the same volume group name ubuntu-vg which causes some conflicts and makes it difficult to distinguish one from the next. So we need to change one of them.

  • Unplug the secondary (delta) drive. If it is internal you'll need to shutdown to do this, since I'm using a dock I just power it down.

  • After reboot, re-run:

    $ sudo vgscan
    Reading all physical volumes.  This may take a while...
    Found volume group "ubuntu-vg" using metadata type lvm2
    
  • Run:

    sudo vgrename /dev/ubuntu-vg /dev/ubuntu-vg-primary
    

    Choose anything you want as the new name, I opted to append -primary here.

  • Now either shutdown and re-attach secondary and reboot, or just attach the drive if using an external dock as I am.

  • Again run:

    $ sudo vgscan
    Reading all physical volumes.  This may take a while...
    Found volume group "ubuntu-vg-primary" using metadata type lvm2
    Found volume group "ubuntu-vg" using metadata type lvm2
    

    This is what we want to see; two unique volume group names.

  • To activate our secondary (delta) drive volume group, run:

    $ sudo vgchange -ay ubuntu-vg
    2 logical volume(s) in volume group "ubuntu-vg" now active
    2 logical volume(s) in volume group "ubuntu-vg-primary" now active
    
  • Make a mount point if you haven't already, such as:

    sudo mkdir -p /mnt/delta/  
    
  • Make the mount point owned by your user:

    sudo chown $(id -u):$(id -g) /mnt/delta/  
    

Important Note:

At this point your system would either fail to reboot into Ubuntu, or it would attempt to load the version of Ubuntu corresponding to the "secondary" drive; At boot time the default/standard is to load from volume group identified as "ubuntu-vg". In order to handle this situation I went ahead and did the following:

$ sudo vgscan  
2 logical volume(s) in volume group "ubuntu-vg" now active
2 logical volume(s) in volume group "ubuntu-vg-primary" now active
$ sudo vgchange -ay ubuntu-vg
$ sudo vgrename /dev/ubuntu-vg /dev/ubuntu-vg-secondary
$ sudo vgscan
2 logical volume(s) in volume group "ubuntu-vg-secondary" now active
2 logical volume(s) in volume group "ubuntu-vg-primary" now active
$ sudo vgchange -ay ubuntu-vg-primary
$ sudo vgrename /dev/ubuntu-vg-primary /dev/ubuntu-vg
$ sudo vgscan
2 logical volume(s) in volume group "ubuntu-vg-secondary" now active
2 logical volume(s) in volume group "ubuntu-vg" now active

Finally we can mount with:

sudo mount /dev/ubuntu-vg-secondary/root /mnt/delta/

At this point you can navigate in Nautilus to "Computer" then /mnt/delta/ and view the root of your external drive. You can quickly add a bookmark to this location so that you can easily access it. You could proceed (cautiously) to backup your existing /etc/fstab (to /etc/fstab.bak) and modify the existing fstab to attempt to auto-mount this device/location to the mount point. Make sure to test your fstab before shutting-down or rebooting.

Using sudo blkid I was able to find all of the relevant UUIDs, devices, partitions, volume group info, as well as FS Types, and use this information to add a mount entry directive to my fstab. For example:

UUID=d7556cd2-67b3-4fb4-acc8-1e33dd0eb040       /mnt/delta      ext4    defaults        0       2

Test using sudo mount -a (no output means good; any output can mean there are errors which should be dealt with before attempting to reboot else you may not be able to reboot back to your OS properly).

1
2

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
10
  • So what do I do if I see "ubuntu-vg" twice as the volume group?
    – Patrick
    Nov 18, 2014 at 1:24
  • Every time I try to mount it, even using the graphical tool, it just mounts the SSD. I am not sure how, but I think I need a way to rename it.
    – Patrick
    Nov 18, 2014 at 1:32
  • If the ssd is a fresh install, my advice is to install without LVM, are you even using LVM ?
    – Panther
    Nov 18, 2014 at 2:03
  • I am not using it for resizing. But it should allow for atomic backups, which is something I would like to start doing.
    – Patrick
    Nov 18, 2014 at 15:31
  • 1
    Yes, but, I would do it with a live usb and unplug the hard drive. vgscan && vgrename old_name new_name
    – Panther
    Nov 20, 2014 at 2:35
1

There are lots of ways to copy over your data, even if your data folders are encrypted. All you have to do is boot the old drive and copy the data you want to copy onto external media and back to the new media. You could also try using the included "backup" utility which works very well in my experience.

Having said all of that, had you asked me before you did the upgrade I've have offered you entirely different advice. I'd have pointed out that 14.04 is an LTS version and that upgrading to 14.10 merely commits you to upgrading every six months, which I find bothersome.

I would have advised you to download clonezilla and merely clone your old hard drive to the new media, directly, and continue using the installation you already have with no need to start over. Of course you can still do that, but by now you might have made up your mind to stick with the new installation.

7
  • I considered sticking with 14.04 and even burnt a disc for both versions. But I was doing this right before a hackathon, at the hackathon, and when I went to boot to the 14.04 disc it wouldn't boot up. So I was left with no choice really. I may end up settling at 15.04 eventually. But I am fine with what I got for now. It is actually nice to have a new install sometimes.
    – Patrick
    Nov 17, 2014 at 15:40
  • I have never used Clonezilla, that may be an interesting solution. And I would rather just be able to load the drive up as an external drive (and should be able to) instead of doing some triple drive setup. I could do that, but it seems like a bigger pain than it should be.
    – Patrick
    Nov 17, 2014 at 15:42
  • 15.04 will not be an LTS version either. LTS versions are only released every two years. Clonezilla is a really versatile drive copier, although it is about as warm and cuddly as the Seagate Disk Manager program for DOS from the early 1990s. I use clonezilla to make about eight copies of my Mubuntsticks at a time. Only about half of them go to end users. The majority are used for my own personal research into the capabilites and limitations of Ubuntu, and for other diagnostic and data recovery purposes.
    – gyropyge
    Nov 18, 2014 at 4:39
  • I was under the impression that LTS versions came out every April.
    – Patrick
    Nov 18, 2014 at 15:32
  • 2
    @pthurmond, thank YOU for the up-vote. The typical tight-fistedness regarding up votes and ill-spirited down-votes on this site is the reason I've not logged in for the past two weeks. If this site has a legitimate purpose, it has to be the true education of users of ubuntu, even if the individual solutions to a particular problem appear to vary. Since you liked my the educational nature of my advice, I'll give you another tip: Download and burn a live CD of 32bit clonezilla and keep it handy, better yet, boot any PC to it just to familiarize yourself. It will come in handy at some point.
    – gyropyge
    Dec 7, 2014 at 3:49
0

You can probably do this UI with KVPM.

Select the group you want to mount and click the "mount fs" option.

enter image description here

You an also rename it from there if needed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .