Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I have read through articles such as this one, but none that I have read through seem to walk me through a setup that I want, and that I hope is possible without some crazy preparation. The article I mentioned seems to set things up on two hardrives, but doesn't mention if there is already data there that you want to maintain and keep as a shared portion of it.

Right now I run a sole installation of Windows 7. My boot drive right now is a 120GB SSD with about 6GB of free space left. I have a backup drive where I store most of my user data, which is a 2TB HDD that has about 1.77TB of free space left.

I would like to install Ubuntu Linux on my HDD, while leaving Windows 7 on the SSD by itself. However, the SSD does not have enough room to store any user data outside of the Windows installation and a few files here and there, so I would like to maintain all of the data that is currently on the backup drive, and keep a "shared" partition on the HDD of user data that both Windows and Linux can touch.

Is there an easy way that I can install Ubuntu on the HDD while keeping the data that is currently there in place (on a majority of the drive), and just partition only what Ubuntu needs to run smoothly on the rest of it?

Ideally I would then also like to boot from the Ubuntu partition and be given Windows 7 as an alternate bootable option in the GRUB menu, but I've only done this on a single hardrive in the past.

Are there any articles or blog posts about setting something like this up? Or do any of you guys have a set of steps I should follow? I just don't want to screw anything up.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Preparation

  1. Free as much space as you can beforehand.

    For Ubuntu, count 10-12 GiB plus 1.5 times size of your RAM for swap partition (You can live with less, but need at least the amount off your RAM if you want to use hibernation).

    This step is not mandatory if you already have enough (i.e. more than 12GiB + swap) space, but is practical: less data there is, the less time is needed for the next step. In other words, you don't need to say goodbye to files, but this is a perfect time to look if there's some thrash to take out.

  2. Defragment the partition that is to be resized. This will simplify (i.e. speed-up, i.e. reduce risk of) the actual resizing.

  3. Boot using a CD/USB with a partition manager like gparted. I guess that Ubuntu live CD already has it, but there are many specialized CDs like sysresccd. (Note that I'm talking about CDs, but most of these can be easily used with USB sticks.)

  4. Resize the partition to make space for the new ones. This is a potentially dangerous operation (power blackout during partition is a very nasty thing), so make sure you have backed up the data.

    I normally use GParted for this job, it has a nice GUI and comes with many live CDs.

    Note that you can resize it so that the "free space" will be before, or after the occupied. Since you are planning to boot from it (and some old boot loaders can't "reach" further than certain place from start), I'd recommend to have the space (i.e. the final Ubuntu partition) before, like this:

    |..........[NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN]|
    
    N - space occupied by NTFS partition
    . - unallocated space (here be lions)
    

Installation

So at this moment you should have disk with only one partition on it that does not occupy all available space. (I'm not mentioning the first disk, of course).

You can leave the rest for Ubuntu installer. I'll list here what basically Ubuntu will need to do---for some of these it will ask you, others might be automatic. However, in 99.9% cases, default option is what you want, and if there is a destructive option, you will be warned:

  1. It will create the new partitions in the free space (...) for you

    • It will most probably ask you if you want it to use "biggest continuous space", which is what you want. (Other choices will be like "usw whole disk", I'm pretty sure this is not the default)

    • It will have its own guess on ideal size for swap partiton and use the rest for the "root" drive

    • it may ask you if you want a separate /home

  2. It will, well, install the system (copy all needed files etc.)

  3. Finally, it will install bootloader (grub2). It may ask where: basically you want to have it where your BIOS will look for it, which is the first drive (SATA1?) by default.

    The items that bootloader will present to you will be determined at this moment, by a quick scan through your partitions. My experience is that unless you have an exotic OS somewhere, this scan is quite reliable.

    Just for illustration:

    |[uuuu][ss][NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN]|
    
    u - (probably ext4) partition with Ubuntu
    s - swap space (here be demons)
    

    Note that sometimes you might end up with some tiny (few MiB) chunks of unallocated space that can't be allocated: just ignore them, reasons why these can't be allocated are complicated and full of history. Let's just say it's a sacrifice to our ancestors' spirits :D

  4. Finally, it will ask you to remove CD and reboot into brand new Ubuntu

Playground for all!

After Ubuntu is installed, it should automatically detect all other partitions (including the one with Windows and the "big one" you want to share) using a smilar mechanism as for flash drives. As long as the filesystem used on the partition is supported (FAT or NTFS), it will be possible to use it from both systems: typically file manager will mount it for you on your first "visit" since boot. Or you can set it up to do that automatically.

One more note regarding shared partitions: Make sure that before you use the partiton from Windows, it has been properly unmounted in Linux and vice-versa or you might have problems with integrity (in worst case, even data loss). This does happen automatically when you turn off the OS, but it might not be the case when using hibernation.

share|improve this answer
    
Thanks for the answer! Just want to confirm some things. When you say free up space - I currently have about 1.77TB of free space, so we are talking about the same drive, right? Also, I partition the space for Ubuntu installation with the 12GB + swap space, but will the rest of the drive with user data on it be accessible via Linux AND Windows? –  Scott Jul 8 '13 at 3:46
    
So I saw your update, and just had one more question, sorry! How is the partition manager going to automatically know which space to partition? Is it going to only partition the space without user data on it, or do I need to backup all the data on a separate hard drive after the defragmentation, and then put it all back on the shared partition once the partitioning has completed? –  Scott Jul 8 '13 at 15:38
    
You don't necessarily have to move the data out, I mention it basically for stochastic cases like blackouts or babies playing with power buttons :D However, it's never a bad idea to backup... –  Alois Mahdal Jul 8 '13 at 16:42
    
However, if you finally end up doing backup of the data to another disk, you can take another approach in resizing the huge partition: Simply delete it and create it again, 12+ GiB smaller. That way you can forget about the first two steps, and the "resizing" will take virtually no time: if there's no data to protect / move, it's all just matter of few bytes in the partition table. –  Alois Mahdal Jul 8 '13 at 16:47
    
Thank you so much for your help! This is exactly what I needed :) –  Scott Jul 9 '13 at 2:02

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.