Step 2: Create a partition for Ubuntu

April 29, 2007

My work attitude towards reformatting is that it should be done as often as necessary – and that is quite often. Every 3-4 weeks or so. IT should provide boot installation services to make this trivial. Network document storage makes this easy. Checking in your code to a private branch makes this easy. Your machine might bork out tomorrow. You shouldn’t fear losing weeks of data.

But at home it’s not quite that easy. My wife and kids rely on the machine for their personal projects and school work. I can’t reformat the system and start from scratch and I wanted to avoid buying a second drive if I could (Circuit City has new laptops for under $400 – why would I want to spend half of that just to get Linux running?).

My current configuration is a 140GB drive that is in a single NTFS partition. It is about 30% full.

The goal was to move everything to the front of the disk, boot to Ubuntu Live CD and figure out how to resize the partition.

I started by running the XP disk cleanup wizard. I’m not a huge fan of this but it consolidates several things I knew I wanted to do into a single action so I could spend my time outside grilling. I also cleaned out my non-system temp directory and uninstalled a few programs that weren’t wanted. This freed up another few gigs and increased the odds of good defragmenting.

I loaded up the XP defrag tool and let it run. Unfortunately it let a few unmovable files in bad places (last quarter of the partition). The size of the unmovable block looked to be at least a gig – it had to be the pagefile (I already have hibernation and restore disks disabled). So I disabled the pagefile and rebooted. After booting I was able to defrag everything except for one thin red line (fragmented file) – it just would not move from the last quarter of the partition. It occurred to me that the file was probably also unmovable but the UI had to pick one color to render. The only thing I could think of was the virus scanner. So I pulled the network cable and disabled the virus scanner and – not surprisingly – the next defrag pass worked like a charm.

I quickly shutdown and booted to Ubuntu.

I did some reading and found several sites that suggested I use qtparted to resize the NTFS partition. Since the live cd does not include qtparted I figured out how to install it –

> sudo apt-get install qtparted

That worked great. I was able to run it and resize the partition (I did not create the new partitions yet). I trimmed off 42 GB from the backend for Linux and shared FAT32 space.

Experienced readers and now laughing and saying “poor newbie didn’t know that a better version of qtparted, called GNOME Partition Editor (gparted) is already installed on the live CD”. Yeah – I found it later. I used it to create the partitions (qtparted was not able to create the extended partition – I have 5 partitions so they couldn’t all be primary).

I rebooted to XP to ensure that everything was still good there – it went through a CHKDSK cycle which went fine and then it needed to reboot once right after starting (I suspect it recognized the drive as a new drive and had to update the hardware configuration). No problems.

Oh – I did backup all of our critical data to DVD before doing any of this.

Finally I was ready to create the new partitions in the newly allocated space. I had 42GB and used this allocation:

/dev/sda2 30GB (ext3)

/dev/sda3 2GB (linux-swap)

/dev/sda5 9+ GB (FAT32)

/dev/sda4 is the root of the extended partition so it does not show up in the list – it is the parent of sda5.

I hope that these were good sizes – they seemed reasonable to me. Only time will tell.

Next step … install Ubuntu.



7 Responses to “Step 2: Create a partition for Ubuntu”

  1. Denmaru Says:

    2GB for the swap? Hm… seems to much to me. Back then, the rule of thumb was RAM x2 as swap partition, but somewhere I heard that a swap-partition isn’t needed anymore.

  2. For the record, gparted is on the Ubuntu LiveCD. system-> administration -> gnome partition editor, so apt-getting qtparted was unnecessary.

    Furthermore, the installer should be able to resize your ntfs partition and install ubuntu on the freed space.

  3. Jakub Says:

    It is if you want to e.g. suspend to disk

  4. Mackenzie Says:

    Swap isn’t really needed anymore if you’ve got a lot. You don’t really want to use a lot of swap as it’s a lot slower than physical ram is. Back in the 90s when you had about 64K of ram, it made sense to use the 1-3x ram rule, but it’s not necessary nowadays. I have 1GB RAM on my Gateway too. I’ve amost never used any swap, even with my 3D desktop going fulltime. It’s happened once. I was writing some PHP and hit an infinite loop and it drove my Apache server and Firefox both simultaneously insane.

    Since FAT32 has a 4GB file-size limitation, you would probably have been better making the shared partition Ext3 like the Linux one. There are very good Ext3 drivers for Windows.

  5. Caleb Says:

    makingtheswitch: I just want to point out that Ubuntu will partition it for you automatically during the install with a new size of your choice, or can launch gparted within the installer if you want to manually edit the partitions.

  6. Morten Says:

    I think it is a mistake to put Linux on the same partition as Windows. I know you said that you didn’t want to spend the extra money, but can’t you just get a hard disk from an old, retired machine?

    One problem comes if you for some reason have to re-install XP, it will simply reformat the MBR and you can not boot into Linux without re-installing GRUB.

    I recommend setting your primary Windows disk to SLAVE. Windows doesn’t like that, but GRUB can fool Windows so it think’s it’s still on the C: drive 🙂

    Install Ubuntu on the new MASTER disk, it will automagically discover Windows on the SLAVE and configure GRUB so it knows about it.

    The advantage of this setup is that both operating systems are independent of each other. You can remove either disk from the machine, and it will still work.

    Good luck with your project!

  7. Janne Says:

    You maybe want to consider having a separate /home partition. /home is where all your user specific files and configurations for every program lie. That way, if you decide to reinstall linux from scratch, you can just wipe the main / (root) partition. During re-install, you can add the old /home partition, so all your files and settings will be immediately available after reinstall.

    I recommend using 15 GB for / and 15 GB for /home. I have a lot of additional programs installed (complete Gnome and KDE desktops, some games, lots of utilities from the repositories, some proprietary software) and I’m using about 9 GB. The /home size should depend on what you are planning to do with Linux. For audio/video editing more is probably better, because the resulting files can be quite big.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: