PDA

View Full Version : Partitioning for Fedora (Multiboot)



sea
18th August 2013, 05:54 PM
Hello Newcomer,

This will only show/"talk" about partitions, not about the installation process of the OS itself.

With a new Operating System (OS) you need space to install it.
Be aware, free space on C:\, D:\ or any other windows drive is not free space on the disk!

To be able to install a new OS we need to free up space on the disk and therfor shrink the partitions windows uses.
Use this enthusiasm and excitement to clean up your drives from garbage, do a proper backup of your important files such as (but not limited to) documents, pictures, self-createtd music/videos/software/websites, settings and game saves.
Save this backup externaly by writing it on cd/dvd/bd or any usb/firewire device you will unplug during installation.
Also be sure to have Windows Installation CD/DvD at hand, just in case you dont like Linux, if you dont, most vendors ship a "Recory Disk Creator" or something alike, use it NOW!



Step 1: Defrag

Defragmentation is required, so all the data is ordered at the beginning of each of its partition, thus cleaning up the free space from any left databits.
This will take a while, anywhere from 3 minutes (unlikely) up to several hours, depending on drive (eg: C: ) size and when you last defragmented your disk.
Therefor continue with step 2 mainwhile...
Either way, once defrag is done, another long waiting is required, start Scandisk to scan your disk for any faulty sectors, so the shrinking table wont be written on a bad block resulting in an unusable system - 99% chances you have to reboot to scan your disk!
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1769



Step 2: Some info

Lets have a look at your disk and know some basic facts and tricks.
Some parts are given, we do require "/" and "swap" even for the smallest setup, however, we do want to have some more comfort, as with Fedora's release cycle of ~6months, you most likley end up installing the OS fresh at least every 18 months.
In many examples you also see a "/boot" partition as well as a "/home" partition.
NOTE: That if you want to use hibernate without issues, you MUST set swap to at least the full amount of RAM, old recommendation suggest twice the amount of your RAM.

In linux you dont have drive letters matching a given partition number, instead you may mount any partition anywhere into a directory (eg: sudo mount /dev/sda11 /mnt/something).
This said, "/home" is in many cases another partition wich may seem empty if it wasnt mounted on boot, same goes for "/boot" which often gets forgotten to be mounted into a chroot to fix possible grub2 or dracut troubles.

If you will install only 1 linux, i suggest to not create a "/boot" partition, unless you want to encrypt "/" and "swap", encrypting "/home" ONLY (incl. swap) does NOT require a "/boot" partition.

NOTE: The bootloader (GRUB2, but Windows just as well) usualy gets installed into MBR, however, with linux one could install the bootloader onto the boot partition, which is "/boot" if existing, "/" otherwise obviously, Windows overwrites any pre-existing bootloader without question or alternative choices!
But whichever bootinstaller is installed last into MBR (even so called on GPT setup) should support all OS' installed - install linux ALWAYS after Windows, as Linux will show on the boot menu as long you dont remove its partition.

This said, you may install as many diffrent linux as you want, for most you do need to install a bootloader as this verifies that you can boot into the new OS. To make any possible rescue easier i suggest to install the bootloader onto the new OS' bootpartition ("/boot" or "/") for the 3rd and any later OS on your disk.
The more experience or understanding you have with/for partitions, the more you will understand how you could use 1 "/boot" for 6 diffrent Linux'.. I wont cover this thought!

For the 2nd OS installation, your first Linux installation, do need to write the bootloader (GRUB2) into MBR (Master Boot Record) so you can boot Linux with ease, this usualy happens at the end of the installation proccess.



Step 3: Analyze Disk

Lets talk about sizes, the suggest (or required) ones.

"swap" 2-4GB ( 1GB )
"/boot" 1-2GB ( 512MB )
"/" 8-24GB ( 6GB )
"/home" *
If you do Video or Sound editing, i suggest 4-8GB for swap and 16-32GB for "/".
As you may mount the Windows partition into your Linux with ease, there is no need to make a 'transfer' or 'exchange' partition.
Using an avarage setup with: "/" and "swap" will require 18GB and additionaly the space you want to use for "/home".
A comfortable basic linux installation takes around 2-6 GB, such as the LiveSpins (http://spins.fedoraproject.org/).
The rest of the space is prepared for additinal software installations.

If you just want to try out a real linux installation, for some rare or security related tasks only, i might recomend no "/home" or one with just 2GB.
Remember, you still may access all your files on Windows drives from Linux, no need to move your movies or mp3's.
On the other hand, if you plan to do VM or use this installation for a long term, i'd recomend to use all space you dont really need in Windows.

So to say, with modern Linux distribution its required to have at least a 20GB harddisk for a Linux only disk, of course one could shrink this easily, but probably not as a newcomer.



Step 4: Shrink Windows partition

"Start" - System Tools - Disk Manager
Most (Pre-Installed) Windows will show up at least 2 existing partitions, maybe even 3.
They are:

RecoveryMode (hidden, usualy around 500-2000mb)
UserSpace (C: )
RecoveryData & FreeSpace (D: )


Now, after you have created (if missing) Windows Recovery Discs and saved your backup to an external and unpluged media and defragmentiation of your driveS, on that disk you will work on, has completed.
Depending on your needs and setup, either remove the drive D: or select it to shrink.
NOTE: Dont just blindly remove drive D:, there are usualy all the program installation data (the setup-'cd's') that were required to setup your computer. You do have created recovery cd's, but maybe you have stored some files here as the space seemed unused...

Lets say you keep "D:" as well, but have used half of the available space, with remaining 50 GB of free space, thus we 'take' 40 GB, leaving 10 GB as 'spare space' on drive "D:".
NOTE: If Windows was set up using 4 partitions, you have to delete the 4th and create an extended partition, of course after backup up data from that partition.

* Start MMC using the run command (WINDOWS+r) and add the "Snap-In" Computermanagement (or Storagemanagement directly).
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1770

* Rightclick the drive you want to shirnk to get the Popup Menu:
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1771

* Change values to your needs:
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1772

While Windows shrinks the partition, i highly recomend to not change a bit on that disk, maybe even to not use the computer at all.

Once this is done, you have now available space to install Fedora Linux on your computer.
Just like Windows, if you use only Linux as an OS, you dont have to do all this extra work.



Step 5: Wot?

Eventhough some use LVM, most of 'us' suggest to NOT use this default setting, be sure to change to "plain".
This is done at the marked spot, just BEFORE you see the partitioning screen...
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1773


There are 2 partitioning shemes out there, MBR and GPT, both are simple explained, but more difficult to understand (the first time)

MBR
allows up to 4 primary partitions which wont allow you to add any further, unless the 4th was THE extended one, so you may add as may logical partitions as you have space for.
If you delete the extended (usualy 4, but may be 3 or 2 too) partition, ALL logical partitions (5+) will be gone!
Extended partition is 4kb in size, this is NOT what you assigned to it -- all remaining space!

GPT
requires a "bios_boot" partition which may be placed anywhere on the disk, just add and remove partitions as you need. (attention its not that easy, and risky!)
Bios_Boot partition is ~2mb in size, you have to assign 1-2mb to this partiton.

There is also something called EFI which is something diffrent than the above, but might be required or have some influence on how things behave.
I have not met any special EFI (tasks?) requiring device, or if, i havent recognized it as such as it behaved just like everything else i've experienced.

IMPORTANT NOTE:
MBR and GPT are the way you set up your partitions, whether they are BRTFS, LVM or plain partitions is up to you!

sea
18th August 2013, 05:54 PM
Step 6: Partitions

Either way, on my laptop with a 320GB disk, i decided to give Windows a 100GB partition, 20 GB for the system, leaving 70 GB for games and their updates (~10 GB get lost because of C:\pagefile.sys - the Windows swap) , giving me 220 GB to be used for/with Linux.
If you only write letters on Windows and dont collect HD movies, even 50-70GB should work fine, however, dont cut off too much Windows WILL act very weird (slow) if there is no space left.

That is me, as i dont boot Windows unless i want to play games, and i have not booted Windows for months now, its not what i suggest, its just what i did, because 'i did the swith to linux' (after a few weeks when did this setup).

Anyway, lets continue with the 40 GB we now have spare.
We will work here with MBR partitions, as they are more 'complex', working with GPT is just adding partitions as you like as long you have a 2 MB "bios_boot" just somewhere on that disk.
If your Windows happen to use only 2 partitions, i recomend to add "/home" first, so you have the extended partition as an optical divider to the partitions to be re-used and overwritten in at least 18 months because of Fedora's 6 months release cycle.
Otherwise, still add "/home" as first, beeing the 5th partiton, as the 4th is the extended one so its the closest linux partition to your 'known computer world - Windows'.
Actualy, the "/home" partition *should* be the largest one for private users, so if everything fails, this *should* be the best indicator.


Exists: 1 - Hidden Windows Recovery
Exists: 2 - Windows C: - System - fat/ntfs (shrinked)
Exists: 3 - Windows D: - Data - fat/ntfs
Add: 4 - extended
Add: 5 - /home - ext4 - 24 GB
Add: 6 - swap - swap - 1 GB
Add: 7 - / - ext4 - 15 GB

Lets say you have more space and less Windows Partitions:

Exists: 1 - Windows C: - System - fat/ntfs (shrinked)
Exists: 2 - Windows D: - Data - fat/ntfs (shrinked ; moved if C: was shrinked too)
Add: 3 - /home - ext4 - 100 GB
Add: 4 - extended
Add: 5 - swap - swap - 2 GB
Add: 6 - / - ext4 - 17 GB

Last but not least, an example with a setup with a "/boot" partition

Exists: 1 - Windows C: - System - fat/ntfs (shrinked)
Exists: 2 - Windows D: - Data - fat/ntfs (shrinked ; moved if C: was shrinked too)
Add: 3 - /home - ext4 - 100 GB
Add: 4 - extended
Add: 5 - / - ext4 - 17 GB
Add: 6 - swap - swap - 2 GB
Add: 7 - /boot - ext3 - 2 GB

With diffrent tools, they might look diffrent:
cfdisk:
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1764

palimpsest (Gnome Partition Tool)
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1766



Step 7: Tools on CLI

Find your available harddisks and their partitions with:

ls /dev/[hs]d[a-z]*
Gives you raw information on UUID, Vendor-/Device-name or the partitions name.

ls /dev/disk/by-*
http://forums.fedoraforum.org/picture.php?albumid=356&pictureid=1765

lsblk, gives a nice output of the partition structure and their mountpoints (if mounted)
blkid, gives a short list focused on UUID handling of partitions

If you happen to have accidently installed Fedora using LVM, these commands might get you started:
(use either man COMMANDNAME or COMMANDNAME -h)

vgscan
vgdisplay
vgchange
lvscan
lvdisplay
lvchange



Step 8: Additional Informations


http://docs.fedoraproject.org/en-US/Fedora/13/html/Installation_Guide/s2-diskpartrecommend-x86.html
http://tldp.org/HOWTO/Partition/
http://www.howtogeek.com/howto/35676/how-to-choose-a-partition-scheme-for-your-linux-pc/
https://wiki.archlinux.org/index.php/Partitioning
http://www.ibm.com/developerworks/library/l-lpic1-v3-104-1/
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s2-diskpartrecommend-x86.html

Gareth Jones
21st August 2013, 09:11 PM
A couple of notes:


If hibernate is to work as expected, swap needs to be large enough to store a copy of the RAM in full, plus some. The old recommendation of swap = 2 x RAM still has relevance for that.
You mentioned encryption briefly with respect to encrypting /home not requiring a separate /boot unless swap is also encrypted. It should probably be mentioned that swap should generally be encrypted if any file-systems are, as the contents of encrypted files could be swapped-out from program memory, unless a security-conscious program specifically marks the pages unswappable.

sea
21st August 2013, 10:37 PM
Thanks for the reminder Gareth.
Applied and updated :)

EDIT:
Oh and one last thing, dont add linux partitions in Windows, this just wont work.

EDIT2:
Users would be thankfull for anyone proving the Windows screenshots in english language ;)
Please send me a PM or attach them here as a tarball for me to reuse in this guide.