I'm running Ubuntu LTS 10.4 on Virtualbox. Out of nowhere, I'm unable to boot into my VM and I get stuck in initramfs.

I have another Ubuntu VM that I can mount the virtual HD to. I just want to copy over my files so I do not lose them.

I attached my virtual HD to /dev/sdb1 and did:

sudo mount /dev/sdb1 /mnt

Yet when I ls /mnt, my home directory is nowhere to be found. How can I get access to the original file system?

  • Your home directory isn't there, but are the other directories showing up? – Bart Silverstrim May 5 '11 at 13:04
  • Was your home directory encrypted on that VM? – Bart Silverstrim May 5 '11 at 13:04
  • A grub directory shows up as well as others. But nothing in the root filesystem. The home directory was no encrypted. – Simian May 5 '11 at 13:11
  • So other directories include lost+found, vmlinuz, memtest etc. – Simian May 5 '11 at 13:20

Probably your home directory is in another partition of the disk ( or even on another disk ). Try first with fdisk -l. That should return something similar to:

Disk /dev/sdb: 145.9 GB, 145999527936
bytes 255 heads, 63 sectors/track,
17750 cylinders Units = cylinders of
16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1           7       56196   83  Linux
/dev/sdb3             263         517     2048287+  83  Linux
/dev/sdb4             518       17750   138424072+   f  W95 Ext'd (LBA)
/dev/sdb5             518         900     3076416   83  Linux
/dev/sdb6             901        1283     3076416   83  Linux

Then try mounting every device on the list one by one and check the files on that filesystem until you find your home partition:

sudo mount /dev/sdb1 /mnt
ls -la /mnt

Are the files from your home directory?. If not continue:

sudo umount /mnt
sudo mount /dev/sdb3 /mnt
ls -la /mnt

Repeat until bingo.

In case of LVM the approach is different.

  1. Mount your / partition ( the one you identified as the / partition before ) on /mnt.
  2. Identify what device corresponds to what mountpoint ( i.e. sdb3 -> /var, sdb4 -> /usr, and so on ).
  3. Mount them on the corresponding directory of the / you mounted on the previous step. ( i.e. if your var filesystem is sdb3 do sudo mount /dev/sdb3 /mnt/var, ... ).
  4. Finally mount the device where you want to copy your home files on /mnt/mnt
  5. You can then do a sudo chroot /mnt; mount /proc;mount /sys and begin working with your mounted image. ( Play with lvm as usual ). Mount your home filesystem ( it should be visible as an lvm volume ), and copy the useful data to the /mnt directory.
  6. Once finished exit and you'll be back to your server.
| improve this answer | |
  • The two partitions at /dev/sdb2 and /dev/sdb5 have types of "Extended" and "Linux LVM" and I can't mount them. – Simian May 5 '11 at 14:32
  • Will this do the trick for LVM? sudo apt-get install lvm2 And how do I handle the extended? – Simian May 5 '11 at 14:34
  • I am unsure of what you are saying. My primary device is /dev/sda. The device that I want to recover data from is /dev/sdb. Running posv shows that /dev/sda5 and /dev/sdb5 have the same volume group of "ubuntu" – Simian May 5 '11 at 15:21
  • I had to rename the LVM volume, there were duplicates. Running mount is just hanging though, any ideas? – Simian May 5 '11 at 15:29
  • Do you see the logical volumes with lvs?. You can try to vgimport the group before attempting to mount – rsl May 5 '11 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.