Dividing the Hard Drive: Food for Thought



ubuntu karmic koala

Pre-OS-install, mapping out data/system demands for optimal disk segmentation saves headaches down the road. Here's a heads-up to help.

You don't have to, but it is a mighty good idea to put pen to paper, ring-fencing the departmental demands you will have on your overall hard disk, or disks.

For instance, you may require space for:-

Setup Unmanaged VPS (4 Noobs!) ... with vpsBible
Secure WordPress. Properly. ... with wpCop, the platform's dedicated security website
Olly 'the_guv' Connelly's vpsBible.com site and 'WordPress 3 Ultimate Security' book.

  • a boot manager (the first thing on the disk, a few mB)
  • the Karmic Koala operating system
  • your personal documents and settings, which generally are housed in your /home directory
  • another operating system
  • and maybe another again
  • a downloads location
  • a location for your music collection
  • another for your movies
  • and another for pics
  • maybe one for websites/special projects
  • a place for backup, else an image of all the above, ideally on a separate hard drive
  • swap (RAM overflow)
  • you get the idea!

How you divvy up the drive is a personal thing, but split it up you will, easily enough, the key partitions being created during the installation process, else prior to that if you use a tool like GParted.

The only must is for any operating systems to be separated, as should the swap file. Furthermore, backup should be in its own location, ideally not just on a separate partition but on an independent hard drive. It is recommendable also to separate user data, housed in the /home folder, to its own partition.

What is a Partition?

Think of your hard drive as a very solid building. Impermeable walls separate the rooms, or partitions, each with their own purposes. If you set fire to one room, the others will be unnaffected.

It is due to the risk of total disk failure (the building collapses!) that you should store backup on a separate volume altogether.

What is SWAP?

If you run out of RAM, a small slice of your disk is called to temporarily take the slack. With Windows, they call that virtual memory.

At it's barest, IMHO, your partition plan should comprise:-

  • the Karmic Koala operating system
  • another operating system (if you want another)
  • your personal documents and settings (/home) to include all personal media
  • backup, but on a separate hard drive
  • swap (RAM overflow)

.. so, of the primary or only hard drive, you have partitions for each of those sections, with backup on another disk. OK, you don't have another disk and really don't want to buy one? This is not good advice, but you can have backup on another partition on the same drive too, or risk all and don't even backup (that is terrible advice!)

Alternatively, the barest possible would look like this:-

  • the Karmic Koala operating system, including your /home directory
  • another operating system (only if you want another)
  • swap (RAM overflow)

.. so that's two partitions, plus one for each subsequent OS.

If you are considering your first future-proof multi-partition setup, and really want to get it right, I suggest you Google a lot. If you want to share docs between, say, Windows and Linux, there are methods to allow you to do that too, so Google again. (For any Windows system, your personal docs should be on a separate partition too, especially as the damn thing always breaks).

Should I Install a Linux System Before Windows?

To save headaches, no. When Linux installs, it recognises other operating systems and allows you to boot to a choice of those on disk. Windows is less usefully inclined. Install Windows first, then Karmic.

What if I want Karmic as my First Partition?

Good call! In that case, rather than using Ubuntu's Partition Manager to resize and/or segment your disk, download and run GParted from boot. (It's better than anything else I've tried, including Acronis' Disk Director and Partition Magic.) You can resize and even move your Windows' partition, although that can (rarely) lead to you having to reinstall Windows as well.

My advice:-

  • plan your pie
  • back up from existing Windows
  • using GParted, format the entire drive and partition as required
  • install Windows on the second partition, then Linux on the first

But. That's an opinion, and there are many others! Google it to gauge what works for you because there is no right nor wrong, just sometimes poor planning or bad luck.

How Much Space To Allow For Each Partition

Hmmn, for your docs, at least, how long is a piece of string? Then again, so far as Ubuntu is concerned, they say:-

“The [operating system] takes between 3-4gB hard drive space, and 8-10gB will be needed to run comfortably.”

.. That doesn't take into account much in the way of personal documents and media, nor additional software installations, so allow for that on top.

Regarding the Linux SWAP size, the jury is permanently out, but it is generally reckoned you should allow for a separate partition of two to three times your hardware's RAM size. I've got 2gB RAM in this laptop, for example, and 4gB SWAP. Is that naughty? Dunno, but it works.

OMG! Just Give Me a Solution, Guv!!

I know, for noobs and even intermediates, this is the hardest bit. That's only because you don't want to cock things up or have to redo. Almost certainly, if you research a bit, you won't cock up, and you won't redo for a good long while. Stay chilled. Have a cup of tea!

Here is a partition suggestion, but merely a suggestion, that allows for Windows (begrudgingly) and backup on a separate disk. It's not ideal, just a basic idea. Like I say, it's a personal thing, and a step that should take you longer to consider than anything else in this guide:-

Partition gB File system Purpose Notes
1 25 Ext4 Karmic system
2 30 ntfs Windows system begrudgingly!
3 100 Ext4 /home – docs
4 50 ntfs Windows docs can be used by Linux
5 4ish swap swap is shared between Linux systems

If you have extra space, divide it between your Windows and Linux docs partitions, or consider adding additional partitions for a rainy day, else those mp3s.

Then, on a separate drive, divide in two:-

1 big! Ext4 Linux docs backup
2 big! ntfs Windows data backup

Allow for Virtual Operating Systems with VirtualBox

One last consideration. In this guide, for those that want to emulate other systems such as Windows or other Linux systems, I'll show you how to add and configure VirtualBox in the imaginatively titled Part 25 – Emulate Virtual OSes with VirtualBox.

In fact, using VirtualBox, you can realistically have a 100% Linux box with a copy of Windows, or whatever system, sitting pretty within.

If you think you may want that option, read Part 25 now so you can best prepare for the extra bulk of those operating systems it allows you to virtualize.

For instance, if you'll be wanting a virtual Windows 7, plus another for, say, OpenSUSE, allow for an extra 25gB for each (to include a bunch of programmes plus rattle space) in your /home directory. Then again, these virtual OSes, undeveloped, will be much smaller at around 10gB each. Just be aware and plan ahead for whatever eventualities are likely to affect you and your biz.

5


About the Author:

Olly Connelly (yeah, that's me) blogs at guvnr.com, polices WordPress security at wpCop.com and helps noobs build web servers at vpsBible.com, so if you've got sleeping problems you know where to come.

Discussion

  1. Jaylon  July 20, 2011

    Ho ho, who wodula thunk it, right?

  2. the_guv  January 9, 2010

    @George, thank you. Google “gParted” and something like “gParted tutorials” (maybe some good ones on YouTube too) .. gParted is the way to go.

    .. well worth spending some time reading up on the boring partitioning theory too, and that of the file formats (ext3/4 for Linux, NTFS for Windows etc.)

    Really partitioning is not difficult and for me always goes .. er, no, I’m not going to tempt fate! .. Just be careful and remember that you cannot destroy your drive or data without being most cavalier!

    @rich .. dunno, to be honest .. but it sounds like an unhappy disc. Run a disk checker.

    For this .. I’d also ask at ubuntuforums.com .. someone there is likely to have had the same issue.

  3. rich painter  January 4, 2010

    I cant get 9.10 to install on my partitions.

    9.10 64-bit live cd
    apt-get install mdadm
    system->administration->disk utility
    (note- gparted would not graphically make my raid-1)
    using 2 1TB sata drives create soft raid-1 mirror using entire drives /dev/sda,sdb
    start installer
    choose manual partition
    select the /dev/md0
    create part 1 988 gb ext4 mount to /
    create part 2 swap 12 gb

    it next formats the ext4 partition 1 OK. then it reports an error in a popup box titled “do you want to resume partitioning?” with a body of “the attempt to mount a filesystem with type swap in RAID0p2 device # at none failed. you may resume partitioning from the partition menu. go back or continue”. in either case of selecting go_back or continue it takes one back to the partitioner.

    there should be no reason that this should fail since the partition’s mount point represents the entire system and no other partitions should be required. this must be a bug.

    how do I get around this? I’m stuck in the installer…

    thanks,
    rich

  4. George A  January 3, 2010

    Many thanks for your trouble in preparing this primer on Ubuntu. I am new to Ubuntu and very much a beginner – the last time I wrote code was in Fortran 4, when I was in school. I’m currently using Ubuntu 9.04 on a stand alone desktop. There is only one partition (approx 230GB)+ SWAP. I have Ext3 formatting on my HDD.

    Can you please indicate whether it is possible (or feasible) to add a partition to my existing HDD without re-installing the OS? I have Partition Magic 8.0, which recognizes Ext3 (but not Ext4) formatting. Many thanks, George

Add a Comment