Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have two computers, but the old one is not working well. So I'd like to install the old hard disk on the new computer.

I know how to do this and I know how to access the data from sdb. But I have some old programs installed on sdb which I'm not able to install them again on sda.

So, I'd like to know if it is possible to use some virtual machine (I have installed VM on sda) to boot from sdb so that I'd be able to use my old programs whenever I need.

I'm using Ubuntu 10.04 on both disks. Thanks.

share|improve this question
    
Maybe if you told us what the programs are, someone could suggest an alternative way of installing them, so you would not have to fiddle with installation. Also, since both systems are 10.04, maybe you could copy the programs, their data and libraries, to /usr/local and see whether they work? –  January Oct 17 '12 at 22:38
    
Some registered programs, like Maple, for example. The problem of copying their folders is to be sure that all the necessary files were copy. –  Sigur Oct 17 '12 at 22:40
    
well, at least you could try and see what happens, and when it fails, ask a question here :-) There are plenty ways of finding out what is missing, including searching for files installed at the same time and differential file lists. From Maple web page: "A Maple 15 license file (license.dat) will be saved in the license folder of your Maple 15 installation" –  January Oct 17 '12 at 22:41

1 Answer 1

If both hard disks have Ubuntu 10.04, then I don't think there's any point in running a virtual machine. Why not just use chroot? If sdb is mounted to /media/olddrive, then you can run:-

$ sudo chroot /media/olddrive

Quite often though, you'll need access to all the system device folders in /dev, /proc and /sys. In which case, you can use mount to create them:-

$ sudo mount -t devtmpfs none /media/olddrive/dev
$ sudo mount -t devpts   none /media/olddrive/dev/pts
$ sudo mount -t proc     none /media/olddrive/proc
$ sudo mount -t sysfs    none /media/olddrive/sys

Of course you can boot from raw hard disks though, with VirtualBox...
It should come with a tool VBoxManage, which can create a ".vmdk" file that is basically a shortcut to the root of a hard drive partition. See here for a little guide on doing this. Note, this latter method isn't really recommended, but I've used it a few times and haven't had any problems with it. One gotcha is that you might have to run VirtualBox with extended (e.g. sudo) privileges to access the raw hard drive partition.

share|improve this answer
    
Thanks but I didn't understand anything. But I'll try to learn. I don't know if I was clear with my aim. If I mount the hard disk as you said how could I fake a boot from it? How to use some programs installed on it? –  Sigur Oct 17 '12 at 22:38
1  
You don't need to "fake a boot", when using chroot. As you're already booted into Ubuntu, chroot just starts a new bash terminal where the path /media/olddrive is interpreted as /, thereby changing the 'root' folder. To login to your user account on sdb, you can enter the command login. From this terminal, you can then run any programs installed on /dev/sdb –  Alex Leach Oct 17 '12 at 22:43
    
Great! So after mount it I should only execute $ sudo chroot /media/olddrive? This will open the new terminal? Or I have to execute all those other commands cited by you? Second: is it possible to run programs with graphical interface, like Maple, for example? Thanks. –  Sigur Oct 17 '12 at 23:08
1  
Yes, pretty much. Note that chroot will actually start the bash shell at /media/olddrive/bin/bash, which will run as the 'root' user. To go back to your running Operating System's shell, type exit. I'd recommend always running login immediately after chroot btw; otherwise you'll be running programs as the root user, which is a bit dangerous. From this user shell, you'll then have to enter exit twice to get back to the running OS's shell. GUI programs will probably require you to run those other commands too - do this before you enter the chroot environment. –  Alex Leach Oct 17 '12 at 23:26
1  
If you have problems with GUI applications being unable to access your X server (the display), see here for info on "Accessing graphical applications inside the chroot". –  Alex Leach Oct 17 '12 at 23:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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