Announcement

Collapse
No announcement yet.

Can a dual boot system use the same home partition and swap partition?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can a dual boot system use the same home partition and swap partition?

    Hi, I'm running Hardy, and would like to have another partition to run another distro of Linux, and am wondering if it is possible to have the two distros use the same home partition, and if I can have the same swap partition for them both. Or do I need to have two swap partitions? Is there anything I would need to know to do this, or can I just make partitions with GParted and install the other distro on one of them?

    The reason I want to do this is because I want to have a partition where I can test other distros without getting rid of my tried and true rock solid beloved Hardy. I want to access the same files so that I don't have to keep remembering to copy back and forth to get the latest version, like my KMyMoney file.

    Thanks!

    #2
    Re: Can a dual boot system use the same home partition and swap partition?

    Sharing the swap partition is no problem. Sharing a /home partition among multiple distributions is not recommended.
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Re: Can a dual boot system use the same home partition and swap partition?

      To belabor the point a bit - if you share /home among various installs and distros you will eventually run into program differences that will/may cause issues.

      However, if your goal is to conserve space and share rather than duplicate data: Consider sharing those files but not /home.

      What I mean by that is I always recommend that a linux install have a separate /home for data backup and safety reasons, but that's not how I do it. I have a separate partition I call /files that contains my pictures, music, videos, documents and so on and THAT partiion is shared among all seven of my linux OS installs by linking to it. Certain other applications I also share data this way - like skype, open office, kopete, a few others. The settings of what's left remain in /home within each install.

      In your example, as long as you're using the same (or nearly so) versions of kmymoney you can share that data without compromising your data.

      Here's how I would go about it:

      1. On your hardy install:
      a. create a directory called /home2 and one called /files
      b. copy your entire /home partition to /home2 - don't forget hidden files BUT EXCLUDE data in Pictures, Documents and so on.
      c. edit /etc/fstab and change /home mount command to /files
      d. boot to a livecd, mount your / partition and rename /home2 to /home
      e.reboot into hardy
      f. in your home, symlink each subdirectory to the data in /files. i.e. link /files/Documents to /home/<USERNAME>/Documents and so on for each directory

      Then on each subsequent install, leave /home within the installs / and symlink to /files/whatever...

      Let me know if this is unclear... I've had a bit of wine tonight!

      Please Read Me

      Comment


        #4
        Re: Can a dual boot system use the same home partition and swap partition?

        Ok, oshunluvr, I understand all of your instructions except

        f. in your home, symlink each subdirectory to the data in /files. i.e. link /files/Documents to /home/<USERNAME>/Documents and so on for each directory
        My goal is that I want to be able to fully use the other distro for all of the things that I do in Hardy, because I can't really tell if I like another distro without doing the things I do in Hardy. That means that I want to be able to access the files that I would use in Hardy. One thing I liked about Hardy that later Kubuntus don't have is the ability to mount my other partition (not sure if it's really recommended, but it never caused a problem), even when I had a Windows partition, I could go to it in Dolphin and get a file that I needed. I can't figure out how to do that in KDE4.

        The other reason is that I thought I could only have 4 partitions on a hard drive, which obviously is not true from your post, if you have seven distros. Doing it your way I'd need six partitions, right? One for each distro, two for /home, and one for /files and one for swap.

        Thanks for the advice!

        Comment


          #5
          Re: Can a dual boot system use the same home partition and swap partition?

          Ok, I just reread your post. Are you saying that I should leave /home on each distro's partition, and only have a separate /files partition? So in that case I would have 4 partitions, One for each distro, one for /files and one for swap. And are you saying that you can install programs like skype in that /files partition and run them in either distro? Or am I totally misunderstanding? All I want to have shared is my stuff that changes frequently, like personal documents, KMyMoney file, fonts (I'm always adding new ones), pictures, etc.

          Comment


            #6
            Re: Can a dual boot system use the same home partition and swap partition?

            You're not totally misunderstanding - it is a bit complicated though...

            First: You can have (almost) as many partitions on a hard drive as you wish - the 4 partition limit applies to PRIMARY partitions only. As long as one of the PRIMARY partitions is an EXTENDED partition, it can hold as many LOGICAL partitions as you desire. Follow? That's why in linux partition numbers 1 to 4 are reserved for primary partitions and logical partitions begin at 5.

            Currently, my 4 hard drives have 10 partitions each but their numbers are 1,2,3,5,6,7,8,9,10,11. Notice #4 is missing - that's because there are only three primary partitions. Primary partition #3 is an extended partition and it holds logical partitions 5 to 11. With windows (at least up to XP - can't say beyond that) you can only address one primary partition on a hard drive at a time but as many logical partitions as you wish. Linux does not have this limitation.

            I hope that explains that clearly enough.

            Back to sharing; Yes - what I am suggesting is that you can let each distro hold /home within itself and then have whatever you want to share among distros on a separate partition. This gives you the maximum control over each distro and your applications, prevents unnecessary duplication of files thus saving hard drive space, preserves critical and personal data, and makes backing up that data simpler.

            I would hate to talk you into something too complicated for your liking so I'll just outline what I do. You can take it or leave it as you wish.

            Currently I have seven distros installed. Of those 2 are "major" - by which I mean are used or usable on a daily basis, 1 is a backup, the other four are for testing out or playing with.

            I then have a large partition I mount as /files. Since I have more than one user on my system, I place my files in /files/stuart.

            Obviously, pictures, documents, music, videos, downloads are all on in /files/stuart, each in their own subdirectory just like they would be in your /home.

            From my /home I also have moved to /files/stuart directory:
            Hidden subdirecties: Reasoning
            .wine can get quite large, holds only games
            .skype shared settings and contacts
            .virtualbox can get very large, VM's are shared and identical
            .mozilla universal access to bookmarks, settings and history
            .thunderbird universal access to email

            Each of these hidden directories is linked to from the /home/stuart directories of only the 2 major and 1 backup distro as I listed above. The 4 "testing" distros are not linked to /files/stuart at all. In the event I want something in one of those distros, I just manually mount /files/stuart and copy what I need.

            The software for each of these programs: Skype, VirtualBox, Firefox, Thunderbird and Wine are all installed on each distro. Only the data from my /home is shared. You would obviously add your KMyMoney files to this list. You could easily add others as you wish and you are not limited to just subdirectories - you could share an individual file the same way. For example, a settings file for dvdrip or your favorite game high scores file.

            The reasons I share data but not the programs themselves is;
            1. In the linux world, distros all have differently ways of doing some things - file locations and such. So installing a program into the distro is necessary.
            2. Each program will still put it's settings and data into your home. Regardless of distro it will know where it's files are. One of the keys to doing this successfully is the use the same (or at least nearly so) program version among all distros sharing that data. For example the upgrade from Thunderbird version 2 to version 3 totally changed the way Thunderbird stores your emails. You wouldn't want the older version messing up the newer version's data. Upgrade all your installs on the same day or at least don't use any program that is on a very different version until it's updated everywhere.
            3. Linux and it's programs take very little hard drive space compared to windows programs. Assuming you use a shared /tmp and shared swap, you can fit an entire linux operating system and every large program you can think of into 10-12gb and usually much less. There's simply no reason to attempt to install a program across three distros. It's much easier to install it three times and then share it's settings and data.

            In your case - having the font files in a shared location is perfect. Fonts have to be "installed" into a distro to be used (usually) so why not have the fonts themselves universally available without duplicating them?

            BTW: I doubt Jaunty, Karmic or Lucid can't access your other partitions. I suspect maybe the way mounting is done has changed. If you need help with that you should start a new thread and ask for help. I use reiserfs, xfs, ext4, btrfs, RAID0, RAID1 and RAID5, fat32 and ntfs formats from Kubuntu, openSUSE, PCLinuxOS, Sayabon and others without problems.

            As far as partitioning I suggest four partitions and one additional for each other distro you want to try out. If you have the space for it one partition as a backup is a good idea also.

            Suggested partitioning setup:

            Size Part. Type and # Use
            2-4gb primary partition 1 swap
            10-30gb primary partition 2 tmp
            all remaining primary partition 3 Extended partition
            10-16gb logical partition 5 main distro
            all remaining logical partition 6 files
            6-8gb logical partition 7 smaller backup install
            10-16 gb logical partitions 8,9,10... additional distros.

            Share /tmp to save additional space - if you do video editing or other things that require large tmp space make it at least 20gb. If you never do that kind of stuff you can make it smaller say 4gb. I don't know how big your hard drive is so adjust sizes accordingly. You can have a fully functioning linux in 2gb but it's not easy and most installers will demand at least 8gb. Sayabon wants at least 12gb I think.

            The reason for the order of partitions above is: swap and tmp you will likely never need to adjust in size and you won't need to remove them. Put your main distro next and leave enough room to install everything under the sun into it - 16gb is plenty if you keep your data and tmp elsewhere. For the backup distro - install something you're very familiar with (hardy) and all the tools you might need - gparted, all disk format tools, and the like. Then leave it alone. Don't do much updating and don't install stuff on it you don't need. Use it to boot to if you mess up your other install and you need to recover. Finally, put the distros you're playing around with at the end of the disk. That way you can delete, resize and reformat them to your hearts content without messing up your main install and data files.

            Please Read Me

            Comment


              #7
              Re: Can a dual boot system use the same home partition and swap partition?

              Thanks! Your explanation is very clear and well thought out. I appreciate your taking the time to explain all this to me. I like your idea about having a backup partition with Hardy on it for safety's sake. My hard drive is 80 gigs. My home folder is usually about 4gigs. Right now I have a 3 gig swap. Your way seems to fit my needs pretty well, and I didn't think about having extra partitions to test more than one other distro. This will make Linux so much more fun and less headache, when I know I can always go back to Hardy in an emergency. Plus I can't ever really get a feel for a new distro if I don't do my normal daily tasks in it, which will be much easier with the /files partition shared among all distros.

              Can I use GParted to move partitions so I have them in the order you recommended, or should I wipe it all out and start from scratch?

              Comment


                #8
                Re: Can a dual boot system use the same home partition and swap partition?

                You can use gparted and it should work OK - I would back up any data you really want to have.

                With 80gb you're gonna be tight. Here's what I suggest:

                Boot to your current hardy install and remove anything you don't use - unused video drivers and input drivers, extra printer and modem drivers, stuff like that. But leave everything you do actually use - no need to "ruin" an otherwise good install. I bet you can get it down to 6gb or less.
                Once you've done that - Make a backup copy of /etc/fstab then edit /etc/fstab and create a new mount entry for /tmp and edit the entry for swap and change the device to /dev/sda1 (or hda1 if your system still uses that id)
                Boot to a livecd and delete all the files in /tmp that's in your hardy partition but don't remove the directory itself.
                Boot to gparted disk
                Delete your old swap partition and all other unused partitions
                Shrink the Hardy partition until there's less than 1 gb free space available and move it to the "right" so there's 6gb available at the beginning of the drive
                Create a new swap of 2gb (unless you really use 3gb) as primary partition #1
                Make space for /tmp about 4gb as primary partition #2
                If Hardy is on a primary partition - that's fine. Have gparted re-number the partitions so hardy is on primary #3. If it's already on a logical partition in extended space, skip down one line (and the pnew partition numbers below will be one higher).
                Create primary #4 and use all the remaining space as EXTENDED
                Create a new logical partition #5 for your data files - say 36gb?
                Reboot into Hardy and verify your new /tmp and swap mount OK, then format and mount your new files partition and move whatever data you want to it.
                Reboot to a livecd and create logical partitions #6,7,8. Make 6 large enough to hold a Hardy install, but just barely. I would guess about 4gb should do it. Remember you're not installing office, games or compiz.
                Do a new Hardy install to partition #6, mount /tmp, swap, and /files in it and install disk cleanup and other utility software to it.

                Now when you boot to your "main" install, it's just like it is now. When you boot to your backup install on #6 - you will have access to your files, but limited toys. I would use a different screen background (like blood red) so you know instantly where you are.

                Again guessing, but you should have near 24 gb left over - that's two 12gb or three 8gb installs or one 16gb and one 8gb - you get the idea.

                When you do a testing installs: Don't bother using your shared /tmp or /files yet. Swap should be picked up automatically by the installer. Don't let the installer over-write your bootloader. Either install the bootloader to the partition your installing to or don't install it at all. This will avoid accidentally making your system unusable.

                If you decide to keep an install you've been testing: mount your /tmp and /files to it and change the default boot to the new install. You can then make the old Hardy install space for a newer distro down the line.

                Some Tips Before you Start:


                1) Did I say backup anything you don't want to lose!?!
                2) Start on paper: Write down what partition scheme you want to end up with and refer it it while you're working. This will avoid forgetting what was going where and how big it was supposed to be.
                3) Make sure you have a livecd and a live gparted cd and a live grub cd and actually boot to them all so you're sure you have a functioning set of rescue tools. These are all available as downloads on the net and are cheap insurance. In the worse case - you'll be able to boot to a livecd and log back on here and yell for help!
                4)Reserve some quite time and have a drink handy.
                5)Relax: as long as you did #1 and not too much #4 you're not likely to do any permanent damage.

                Please Read Me

                Comment


                  #9
                  Re: Can a dual boot system use the same home partition and swap partition?

                  Ok, I'm looking at your instructions and realizing that I don't know what the /tmp directory is for, and why it would need 10-30 gb and be on a separate partition. Right now in Hardy my Root/tmp directory is only 122.8kb. Am I missing something? I don't want to do this without understanding what each partition is for.

                  You mentioned that I should make /tmp bigger if I do video editing or things that take lots of tmp space. I don't do any video editing or music editing on my computer. I mainly surf the net, do my finances, word processing, page layout (Scribus) stuff, digital pictures and short videos from my digital camera (storing and viewing only). I don't store any songs on my computer either. My entire /home is 1.3 gigs right now, but I usually have more pictures and videos on it than I do right now. The fullest it's been is around 4 gigs.

                  Comment


                    #10
                    Re: Can a dual boot system use the same home partition and swap partition?

                    oshunluvr is a bit over zealous me thinks.

                    You really only need one partition, but two (excluding a swap partition) are recommended. This allows for the installation of the main OS ( root ) into it's own partition and all user files in it's own partition.

                    How much space do you actually have used on your HD, and how much free space is (or can be made) available for a second OS?
                    Using Kubuntu Linux since March 23, 2007
                    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                    Comment


                      #11
                      Re: Can a dual boot system use the same home partition and swap partition?

                      Originally posted by Snowhog
                      oshunluvr is a bit over zealous me thinks.
                      Only a bit

                      Of course, snowhog is right. I tend to talk people into a /tmp just because I've seen enough people jam themselves by filing their / and leaving themselves unbootable.

                      In your case I recommended a /tmp because you only have an 80gb hard drive and if you were going to be playing with 2 or 3 additional distros along with your main one - that is space that can be shared, thus saving space overall. For example, even if you only need 4gb space for /tmp for each distro: If you had 4 installed, that's 16gb. So why not share a 6gb /tmp, saving 10gb (enough for another distro). Each distro can only be active one at a time so they don't all need 4gb of unused space and by sharing, each actually has a larger /tmp.

                      You need not use the /tmp if you don't want and in fact - it's not that hard to add it later if you find you changed your mind.

                      If you really never use more than 4gb for /home, you have plenty of space to not use a separate /tmp.

                      Please Read Me

                      Comment


                        #12
                        Re: Can a dual boot system use the same home partition and swap partition?

                        I have 6.5 gigs used on my hard drive right now. That is my Hardy install including my /home folder and all my documents. My swap is 3 gigs. I have an 80 gig hard drive, so this leaves 70 gigs free for other distros and stuff.

                        I think I want Hardy as my main install for a while yet (my system doesn't seem to really like anything other than Hardy), and then one (possibly two) other distros for testing. So if I put my partitions in this order:

                        primary parition 1: swap - 3 gigs
                        primary partition 2: tmp - 4 gigs (possibly not needed??)
                        primary partition 3 (extended): all remaining space, consisting of the following logical partitions:
                        logical partition 5: Hardy - 10 gigs
                        logical partition 6: probably Mepis for now - 16 gigs
                        logical partition 7: some other distro - 16 gigs
                        logical partition 8: /files - all remaining space, approx 31 gigs

                        Is this reasonable?

                        Comment


                          #13
                          Re: Can a dual boot system use the same home partition and swap partition?

                          Sure. That would work.

                          logical partition 5: Hardy - 10 gigs
                          logical partition 6: probably Mepis for now - 16 gigs
                          logical partition 7: some other distro - 16 gigs
                          This implies that you would not have a separate /home partition for these other three OS's. That goes along with my "You really only need one partition," statement. While you can do this, and you are saying that these would be 'testing' OS's, you are taking a risk. IF you ever have problems with the OS, and you have to reinstall it, you will loose all user settings, as the user /home directory is contained within the root file tree (on the same partition). If this doesn't worry you, then such a setup is fine.
                          Using Kubuntu Linux since March 23, 2007
                          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                          Comment


                            #14
                            Re: Can a dual boot system use the same home partition and swap partition?

                            While my laptops HD is larger, this is how I have it configured:
                            Disk /dev/sda: 120.0 GB, 120034123776 bytes
                            255 heads, 63 sectors/track, 14593 cylinders
                            Units = cylinders of 16065 * 512 = 8225280 bytes
                            Sector size (logical/physical): 512 bytes / 512 bytes
                            I/O size (minimum/optimal): 512 bytes / 512 bytes
                            Disk identifier: 0xc528b3c5

                            Code:
                              Device Boot   Start     End   Blocks  Id System
                            /dev/sda1  *      1    1044   8385898+ 83 Linux << Kubuntu 9.04 / partition 8Gb
                            /dev/sda2      1045    2088   8385930  83 Linux << Kubuntu 9.10 / partition 8Gb
                            /dev/sda3      2089    3132   8385930  83 Linux << Kubuntu 10.04 / partition 8Gb
                            /dev/sda4      3133    14593  92060452  5 Extended
                            /dev/sda5      3133    5743  20972826  83 Linux << Kubuntu 9.04 /home partition 20Gb
                            /dev/sda6      5744    8354  20972826  83 Linux << Kubuntu 9.10 /home partition 20Gb
                            /dev/sda7      8355    10965  20972826  83 Linux << Kubuntu 10.04 /home partition 20Gb
                            /dev/sda8      14333    14593   2096451  82 Linux swap / Solaris << Swap 2Gb
                            I still have enough 'unused' space on the HD for another OS, or for expansion management if needed.
                            Using Kubuntu Linux since March 23, 2007
                            "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                            Comment


                              #15
                              Re: Can a dual boot system use the same home partition and swap partition?

                              I think Snowhog is as anal as I am!

                              8,8,8 - 20,20,20 Nice even layout - I like it!

                              Mine is a totally over-done desktop

                              4 - 500gb hard drives, all partitioned the same:

                              Code:
                                Device Boot   Start     End   Blocks  Id System
                              /dev/sda1        1     131   1052226  82 Linux swap / Solaris
                              /dev/sda2  *     132     182   409657+ 83 Linux 
                              /dev/sda3       183    60801  486922087  5 Extended
                              /dev/sda5  *     183    2271  16779861  83 Linux
                              /dev/sda6      2272    2793   4192933+ 83 Linux
                              /dev/sda7      2794    3315   4192933+ 83 Linux
                              /dev/sda8      3316    8537  41945683+ 83 Linux
                              /dev/sda9      8538    9059   4192933+ 83 Linux
                              /dev/sda10      9060    9581   4192933+ 83 Linux
                              /dev/sda11      9582    60801  411424618+ 83 Linux
                              The #2 partitions hold /grub and 3 /boot's
                              The #5's hold backup Kubuntu 9.10, Sayabon 5.2, PCLinuxOS 2010, Chakra/Arch
                              The #6 through #10 are all raid devices
                              #6 RAID0 16gb total /tmp
                              #7 RAID0 16gb total Kubuntu 9.10
                              #8 RAID5 160gb total /files
                              #9 RAID0 16gb total Kubuntu 10.04
                              #10 RAID0 16gb total openSuse 11.2

                              Partitions #11 are 393gb each in btrfs format and used for data backups.


                              reidun
                              : I think your plan will work fine. If you decide you want to keep /home separate for all your distros like snowhog suggests, you could mount your /files partition as /home and use a different home subdirectory for each install. The default home directory is always /home/<USERNAME> but you can use any directory you like.

                              Please Read Me

                              Comment

                              Working...
                              X