Drive Partitioning

From BrainwreckedTech's Wiki
Jump to: navigation, search
Under construction icon-blue.svg

UNDER CONSTRUCTION

The author walked away without completing this article.
Most likely, it was beginning to drive them up the wall.

Most people don't know about hard drive partitioning. With the way most OEM computers and external storage medium is shipped, the only time a person would come face-to-face with partitions is when buying an internal hard drive or installing Linux. While this certainly makes things easier to set up, it can make things more difficult in the long run. Chiefly, when operating system data gets borked by a virus, bad system setting, or hardware failure. By using partitions to separate data, that data becomes easier to maintain.

Contents

Limitations of Partitions

While newer PCs are beginning to utilize UEFI and GPT, most computers still utilize BIOS and MBR introduced all the way back in 1980. MBR carries some serious limitations.

  • Limit of 4 primary partitions
    • 1 primary partition can be designated as an extended partition
    • The extended partition can contain any number of logical partitions
    • Windows will not allow you to install it to a logical partition
      • This includes recovery tools based on Windows.
  • Limit of 232-1 (4,294,967,295) addressable sectors
    • 512B sectors makes for 2TB
    • 4K sectors would make for 16TB
    • Manufactures are still falsely reporting 512B sectors to maintain compatibility.

If you are able to use GPT, by all means use it as it simplifies matters greatly.

Recovery Partition

If you bought a pre-made computer and you did not receive any recovery discs, chances are that your OEM has created a partition at the beginning of the hard disk for use as a recovery partition. The partition is usually marked as hidden but can be accessed during the BIOS boot process.

It's best just to get rid of the partition all together.

  1. Find the OEM's recovery disc creation program in the installed OS and run it.
  2. Make ISO backups of the recovery discs to an external drive or network share.
  3. Re-partition the drive to suit your needs.
  4. Boot from the recovery discs to re-install your operating system.

Notes

KB, MB, GB, and TB will be the binary definition of KB, MB, GB, and TB.

AF = Advance Format (4K internal sectors)
NF = Normal Format (512B internal sectors)

In preparation for AF drives, all space allocations recommendations will be in 4KB chunks.

Linux's fdisk forces partitions to be aligned to 1MB boundaries.
GNU's parted will let you to start at sector 1 if you want.
If using an AF drive, you'll want to start at sector 8.
If using GRUB2, you'll want to start at sector 63/64.

Single OS Solutions

Use A Single Partition

Stop hand nuvola.svg

WARNING: This is not recommended at all!

If you place all your data in a single partition, you can kiss it goodbye if the fliesystem becomes horribly corrupted. Even if you make backups, say hello to the aggravation of restoring from backups.

This is the default setup for Windows and Mac OS. However, both of these operating systems create a swap file within the main file system by default, whereas Linux does not. While Linux really doesn't care if you have swap space or not, it will also be more than happy to just freeze on you when you run out of memory.

Still want the swap space in Linux but don't want the added partition? The trick is to create the partition, format it, mount it, and then issue the following commands. Note that count=1024 will give you 1GB.

dd if=/dev/zero of=/mnt/swapfile bs=1M count=1024
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile

You can mount the swap file immediately by using:

swapon /mnt/swapfile

You can mount the swap file at boot time by editing /etc/fstab to include this line:

 /mnt/swapfile none swap sw 0 0

Use Two Partitions

This is a much better compromise between partition consolidation and data retention.

HR size Bytes NF Sects FS Mnt
2GB GM NewTux.png
5GB GM NewTux.png
30GB Windows Flag Logo.png
2,147,483,648
5,368,709,120
32,212,254,720
4,194,304
10,485,760
62,914,560
any
any
NTFS
/ (root)
/ (root)
C:
Where the operating system and programs will reside. The first recommendation is for servers. The second is for desktops.
free space free space free sectors any GM NewTux.png /home
Windows Flag Logo.png C:\Users
Kept separate so that it's easier to upgrade the OS without worrying about the data.

While Windows does not have the same filesystem mounting concept as Linux, Windows has had junctions (hard links) since Windows 2000. You can use this to craftily move C:\Users (C:\Documents and Settings in 2000 and XP) to another partition/drive.

Using More Partitions

Of course the choices are limitless. Some common things that you may want to partition off are:

Boot Loader
Needed only if using Linux with a root partition that is encrypted or RAIDed.
Games
Putting your games onto a separate partition usually makes it easier to backup and share games between OSes. Steam is a perfect candidate for this.
"Local" Share
Useful as a places to transfer files between OSes or for when network storage/transfer would really bog things down (Virtual Machines, DVD/Bluray ripping).
Swap
Creating a separate partition for this is normal for Linux but not for Windows. The only problem with Windows is that there will be file system overhead space-wise. (Example: An 8GB partition loses 10.5MB to the file system.)


Dual-OS Solutions

Windows requires installation to a primary partition. Additionally, many OEMs use up one partition for recovery.

If you are not encrypting, RAIDing, or LVMing your hard drive(s), /boot does not need its own partition. This should free up one partition.

You can also use LVM to split one physical partition into two logical ones. In this event, join the values for swap and / (root), use the space for a single LVM group, and define the logical volumes accordingly.

Linux, with NFS, can have the /home directory hosted on a file server.

If all else fails, Linux will be happy to exist on Extended Partitions, unlike Windows.

Personal tools
Namespaces
Variants
Actions
Navigation
Add data
Help
Data export
Toolbox