Linux Today: Linux News On Internet Time.
Search Linux Today
search.internet.com
Linux News Sections:  Blog -  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Blog
Linux Today Navigation
LT Home
Preferences
Contribute
Link to Us
Search
Linux Jobs

Marketplace Partners

internet.commerce
Be a Commerce Partner

The Linux Channel at internet.com
Linux Today
Enterprise Linux Today
Apache Today
JustLinux.com
Linux Planet
PHPBuilder
All Linux Devices
Technology Jobs

Linux Jobs

linuxtoday Newsletters
Subscribe News
Subscribe PR
Subscribe Security
Subscribe Jobs

internet.com / blogs

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
searchcats.jpg

February 2011
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28          

Painless Linux Multi-boot Setup

| | Comments (11) | TrackBacks (0)
Virtualization, especially with nice virtualizers like VirtualBox and KVM, makes it easy to run multiple guest operating systems and not have to hassle with rebooting, like you do with a multi-boot setup. But I still favor multi-booting for testing new Linux distributions. There are fewer hassles with networking and file-sharing, and when there are problems I don't have to figure out if it's something weird with the VM.

The common wisdom is to have a shared home directory in a multiboot setup, but this has its own set of potential problems because it mixes data files and configuration files. So when you're trying out different distributions, your desktop settings may not translate gracefully across all of them. So what's the answer?

The answer is simple: create a separate data partition, and let every distro that you install have its own unique ~/home for your dotfiles. You'll jump through a couple of extra hoops to make your data directory accessible across all of your installed Linuxes, but it's no big deal, and it's easier than trying to make your dotfiles work across multiple distros and desktop versions.

Your data directory has to go somewhere other than ~/home. I put it on its own partition or on a separate hard drive. You could even use a nice USB stick.

You must start from already having at least one Linux installed. In this example I will use the partition (block device) /dev/sda5 for data storage. GParted and Parted are very nice for graphical partitioning and creating filesystems.

Once the partition is created and formatted with a filesystem, mount it temporarily in your own home directory. To do this first create a mountpoint:

carla@xena:~$ mkdir mydata
Then you'll need rootly powers to mount your new partition there. Technically you're mounting a filesystem; whatever you call it this is how you do it:
carla@xena:~$ su
xena:/home/carla# mount /dev/sda5 /home/carla/mydata
Ubuntu's sudo command works too, for this and all the root commands in this article:
carla@xena:~$ sudo mount /dev/sda5 /home/carla/mydata
Now you need to give yourself ownership of this directory, since root owns it:
xena:/home/carla# chown -R carla:carla  /home/carla/mydata
Now you should have full read/write access to this directory as your ordinary unprivileged user, and should be able to copy files to it.

The final step, since this is going to function as your home data files directory, is to have it mount automatically at boot. We'll do this by editing good old /etc/fstab. Add a line like this to /etc/fstab, using your own filenames and filesystem type:

/dev/sda5   /home/carla/mydata  ext3 user,defaults  0  0
I prefer to use the block device UUIDs since those are unique and can't be messed up by hotplug or udev or anything else, especially for a USB stick. Find your UUID with the vol_id command, which requires rootly powers:
xena:/home/carla# vol_id --uuid /dev/sda2
40295806-448b-4fdf-9ce8-5f5fc7984c9b
Then use the UUID in place of /dev/sda5, or whatever your block device is, like this:

UUID=40295806-448b-4fdf-9ce8-5f5fc7984c9b /home/carla/mydata ext3 user,defaults 0 0

Now every time you boot up your new data directory will be there all ready to use.

Now all you need to do is create the same mountpoint and use the same line in /etc/fstab in every Linux that you install on your multiboot machine, and your data directory will appear in your home directory in every one of them. Your dotfiles will be unique to each Linux, so you won't have any configuration conflicts.

Tips: use the mount command with no options to see your mounted filesystems and what block devices they are on. umount manually unmounts a filesystem. If you get a "device busy" error with umount it means something is reading the filesystem, like your file manager. Close any documents or change your file manager to a different directory. lsof mydata, or whatever your directory name, lists any open files.


0 TrackBacks

Listed below are links to blogs that reference this entry: Painless Linux Multi-boot Setup.

TrackBack URL for this entry: https://swarm.internet.com/mt-tb.cgi/8632


11 Comments

Ram Sambamurthy said:

This is one of the problems I had faced as well, so thanks for the article.

One thing though, some applications do use dotfiles to save their data. For e.g., Thunderbird saves all email in a dotfile.

How does one get out of this situation?


Hi Ram,

I don't use Thunderbird so I don't have a for-sure answer. With KMail you can edit .kmailrc so it will use any directory you want to store mail in. Maybe Thunderbird has a similar option somewhere?


Timothy said:

Thank You for this article. That UUID trick was new to me.

I dislike putting user ids and such "personal" modifications in /etc/fstab. However, I haven't found a way to mount devices or network shares under /home without it and I'm too forced to mess up with my fstab (I keep my virtual machines on separate partition)! Are You aware of any such possibilities? sudo mount -script could be one possibility but it's not very clean solution :|


Thunderbird does have that option, just like Firefox, in the profiles.ini file.


Seth Brown said:

I solve this in a slightly different way. Each distro normally allows you to specify the user's home directory. So I point this at a sub-folder for the specific distro. Eg. /home/jack/zenwalk, /home/jack/slackware, etc.

The distro copies its dot files into the subdirectory, leaving /home/jack relatively free of dot files.

Or am I completely misunderstandig your point?


ComputerBob said:

@Ram,
I store my Thunderbird profile and my Firefox profile in my separate data partition, similar to Carla's solution, and then whenever I install another distro, I simply point it to those two existing profiles.
Here's a how-to for TBird:

http://www.mozilla.org/support/thunderbird/profile#move

ComputerBob
Making Geek-Speak Chic Online Since 1997
http://www.computerbob.com/


Morgan Hall said:

My personal solution (yes, I use thunderbird) -- I make my data directory a partion mounted on /usr/local so my homebrew apps are in /usr/local/bin. A data directory there contains the working directories for home data -- /usr/local/morganh/Data

Directories in /usr/local/morganh/Data include Dowloads, Video, VirtualBox, mozilla, mozilla-thunderbird and so forth.

I install the new distribution, mount my /usr/local, strip out everything except Desktop from /home/morganh then run:

for i in `echo /usr/local/morganh/Data`;do; ln -s $i; done

Then:
mv VirtualBox .VirtualBox
mv mozilla .mozilla
mv mozilla-thunderbird .mozilla-thunderbird

Now I'm good to go


TwinsDad9901 said:

I have had as many a 4 distros installed on one computer at the same time. At first I tried to keep my /home directory on a separate partition (actually, I had another drive) and use it in all the versions I had installed. I thought that if I had the first distro set up the way I wanted it, the others would be the same. But I found out that each distro used different types of settings, especially if I was running a Debian-based and and RPM-based distro. I solved the problem by letting each distro have a /home directory in it to keep all the settings and then I set up a directory in another partition that held my files (pictures, documents, mail, etc). I sym-linked the appropiate files in each distro's /home directory to the actual files. I found that I could use my mail (I usually use Evolution) and see my documents in whatever distro I was in and not lose anything. Of course, YMMV.


Keith Hague said:

I map other partitions in as /media/main, /media/data and /media/backup, which is easily done when installing Ubuntu for example, then in those areas I have created a directory with my username just as in the home directory and used chown and chgrp to change ownership. I keep my essential data and backups in those areas. I also have a script which only needs to be run after installing a distro that creates a link to the directories I need in the home directory of the new install e.g. ln -s /media/data/username/video /home/username/video. I find this works well. The script also renames the dotted directories created by Firefox, Thunderbird and others, and creates links to the dotted directories for those as well. This carries my bookmarks and emails through each install. Some directories are also setup as Samba shares, which are mapped in to Windows virtual machines, allowing me to easily share data between Linux and Windows when needed. Having the Samba shares setup this way allows me to share certain data (with Windows) without compromising the security on all my data. I finally decided on this approach after having 'moved' my data between quite a few installations and got tired of the hassle!


chai said:

greate post, i believe thunderbird also save the files in .ini


chai2 said:

Try this Multi boot [Dedicated GRUB Partition]
http://ubuntuforums.org/showthread.php?p=7343886



Leave a comment








All times are recorded in UTC.
Linux is a trademark of Linus Torvalds.
Powered by Linux, Apache and PHP