LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Choosing a partition scheme (https://www.linuxquestions.org/questions/linux-newbie-8/choosing-a-partition-scheme-4175636892/)

fyzx92 08-22-2018 02:16 PM

Choosing a partition scheme
 
I want to install linux on my desktop and keep the possibility of additionally installing Windows later. I want to have a separate /home partition to allow me to try different distros easily, and ideally that same directory would be accessible by Windows.

I was thinking of having a partition each for Windows, Linux OS, swap, /home, and /boot, but don't know if I need all of those, or which should be of which types (primary, extended, logical).

Also, I have two large hard drives (460 GB and 150 GB), but I was just going to mount the smaller one inside a folder of /home. Just thought I'd add this here in case it was significant.

So, the main questions:
1) what partitions do I need?
2) what are their minimum recommended sizes?
3) which should be primary, which should be extended, which should be logical?

joe_2000 08-22-2018 02:40 PM

Quote:

Originally Posted by fyzx92 (Post 5894529)
I want to install linux on my desktop and keep the possibility of additionally installing Windows later. I want to have a separate /home partition to allow me to try different distros easily, and ideally that same directory would be accessible by Windows.

I was thinking of having a partition each for Windows, Linux OS, swap, /home, and /boot, but don't know if I need all of those, or which should be of which types (primary, extended, logical).

Also, I have two large hard drives (460 GB and 150 GB), but I was just going to mount the smaller one inside a folder of /home. Just thought I'd add this here in case it was significant.

So, the main questions:
1) what partitions do I need?
2) what are their minimum recommended sizes?
3) which should be primary, which should be extended, which should be logical?

Note that the easiest way for dual boot installation of windows and linux is first installing windows, as windows installations tend to at least wipe the boot loader. You can install windows after linux, but you need to be a littlebit careful and you will have to fix the linux boot loader afterwards.

1) It depends on what you want to do. Separate /boot is mainly needed if you want to encrypt the disk. (Even then you don't really need a separate /boot anymore because grub can also handle full disk encryption, but that's just a side note).
swap is a matter of taste. If you have a small RAM it makes sense. Some argue that beyond 8GB of RAM, swap is not really needed any more. There is one caveat: If you want to suspend to RAM (I keep forgetting whether that's hibernating or suspending) you need swap, and it must be larger than your RAM. Probably not relevant for you, as you were talking about a desktop.

As far as the separate /home is concerned: Using the same /home partition for different distros is not a good idea because they will each be overwriting the config files of the others. Better create a pure data partition and mount it under e.g. /mnt/data. Then create a symlink pointing to it in your home. That way, each distro gets to have their own config files.
Another advantage: You don't need to use a windows readable filesystem for your /home. If you want to access your data from windows I recommend making the data partition ntfs. (Only do this if you really need to access the data from windows, as ntfs has many shortcomings then can be annoying)

2) Recommended sizes: For swap see comments above. For the root file systems it depends on how much software you want to install. I typically give a linux root file system 100GB. But 50 would probably be way enough. For a current windows I have no idea. I know that the last preinstalled win7 I saw was 40GB. I'd expected it to grow beyond 100GB easily.
For data: Only you can tell.

3) Extended partitions are a workaround of the old days to be able to use more partitions. Don't use an msdos partition table but a GPT partition table, then you don't need to worry about this.

fyzx92 08-22-2018 03:57 PM

If I install linux now, and windows later, you're saying the bootloader will be screwed up, right? But will any of the data or other partitions be messed up? That is, when I install windows, can I then just reinstall linux + programs to make it work? Admittedly, that may be a pain in the ass.

For the data partition, is that where all my personal files would go, or is that a place just for config files?

Rickkkk 08-22-2018 04:10 PM

Quote:

Originally Posted by fyzx92 (Post 5894574)
If I install linux now, and windows later, you're saying the bootloader will be screwed up, right? But will any of the data or other partitions be messed up? That is, when I install windows, can I then just reinstall linux + programs to make it work? Admittedly, that may be a pain in the ass.

For the data partition, is that where all my personal files would go, or is that a place just for config files?

... in answer to your above questions and following on the excellent information provided above by joe_2000:
  • If you are careful when installing Windows after linux, you can actually avoid it "screwing up the bootloader". This is easier if you have UEFI firmware and have partitioned your disk in GPT mode and included an EFI System Partition (ESP).

  • This said, you have to be careful of the method you use to install Windows and where you are installing it. Make sure you are installing it to an empty partition and make sure you aren't telling it to repartition and reformat your entire disk.

  • These are some of the reasons it is normally recommended to install Windows 1st and linux afterwards ... Windows fully expects to be the only OS on the system and you have to be vigilant when installing it on a disk where another one is already present.

  • So in a nutshell, if you do it right, neither the bootloader nor your existing data or linux partitions need be affected, and you wouldn't have to reinstall linux.

  • Whatever scenario you choose, back up anything important before installing a second OS or operating on the partitioning of a disk.

  • The separate data partition suggested by joe_2000 is where your data will go, not your config files. Config files will reside within each OS's own partition (in linux, partly in your home directory and elsewhere, in Windows, mostly in c:\Program Data ....

Cheers !

fyzx92 08-22-2018 05:18 PM

Awesome! I was planning on keeping an empty partition that would be saved for windows, and I think with those tips, I can figure out how to install windows safely, and I'll be sure to look into it more when the time actually comes.

Some follow up questions to the data partition:
How does having an additional partition separately mounted solve the problem of overwriting config files if they're mostly saved in separate places anyways? (if too complicated to explain easily, that's fine)
Would it be possible for me to save some files in home (which would be visible only to linux, I assume?), and some in data (visible to both?)

@Rickkkk: to be clear, you're suggesting that I have an EFI partition in addition? Which would make the total list to be /, Windows OS, swap, data, /home, and EFI (550MiB according to ArchWiki)?
Edit: maybe a recovery partition too?

pholland 08-22-2018 08:14 PM

My preference would be to use the smaller hard drive solely for linux. The larger drive could be mostly for Windows with maybe a 100-150 GB data storage partition for the linux OSes to use.

syg00 08-22-2018 09:15 PM

Nah, I would ... just joking; ask 10 people, get 8 opinions ... :shrug:

Some technical issues exists, but after that pretty much anything goes. Which windows ? - if Win10 I think it will only install fresh to a gpt disk. I have it on MBR disk on a couple of systems, but that isn't true of retail versions I believe. Is this a "clean system" or is there data on the disks ?. Is it a EFI system ? - just check the "BIOS" when you power it on.
Do you have a Linux install/live ISO on a CD or USB ?. Can you get around in that - say use a terminal ?.

Forgot: the recovery partition is Windows only - it will get created at install if you simply leave some unallocated space for the installer to use (just one big area is ok).

mrmazda 08-22-2018 11:25 PM

There's no point in being concerned about installing Windows after Linux if you prepare in advance. After all, you're not going to reinstall Linux every time you need to reinstall Windows, which need is virtually inevitable. Simply install Linux to not depend on its bootloader living on the MBR. I have bunches of multiboot PCs, many of which include Windows, and Windows has never been the first installed OS here, ever, except in a rare case or two of being the only OS installed.

Partition in advance and you can have any partition scheme that suits your fancy, whether on MBR or UEFI, whether on one disk or more. On MBR, I recommend three partitions dedicated to Windows, a very small primary to boot from, one logical for the OS, another logical for data. It's the same principle as used for Linux with a separate home so that when the OS is replaced, all user data remains intact. Likewise for the separate boot, so that any time booting becomes an issue, repair does not necessitate complete installation.

Having Windows using only one small primary facilitates having Linux boot from the same generic MBR code Windows depends on. Two primaries can be dedicated to Linux, which along with the small Windows primary, leaves the 4th primary available for as many logicals as you care to have. sda1 can be Windows, sda2 can be a separate Linux boot or a full Linux installation, and same for sda3. If you're going to have more than one Linux OS, which I recommend, then you want a primary under your personal exclusive control, which facilitates preventing subsequent installations usurping control from working installations, including Windows, in the form of a home for a master bootloader.

Many moons ago I created http://fm.no-ip.com/PC/install-doz-after.html in large part to show how to partition for Windows with Linux. The disk and partitions are small, but the strategy remains valid for those still using MBR partitioning. The 3 PCs I have Windows 10 on use the exact same strategy, just with bigger disk and partition sizes, and no need for any recovery partition or GPT, such as this one: http://fm.no-ip.com/Share/multibootWinParts.txt

Using UEFI/GPT can be easier, because the MBR isn't subject to usurpation, depending on sharing of one EFI//ESP partition by all involved OSes, and there's no confusion over primary vs. logical partitions. UEFI depends more on having a good understanding of the UEFI system, particularly as employed by your own PC's BIOS, and the fact that all installed OSes must use either UEFI or MBR, never a mixture of both in the same PC.

If you're going the UEFI route, I suggest the following template:
Code:

sda1    320MB FAT EFI/ESP
sda2    100MB NTFS Windows reserved
sda3  48000MB NTFS Windows OS
sda4  96000MB NTFS Windows data
sda5  4100MB Linux swap
sda6  18000MB EXT4 Linux root #1 distro
sda7  18000MB EXT4 Linux root #2 alternate or version next distro
sda8  18000MB EXT4 Linux root #3 alpha/beta distro testing
sda9 275480MB EXT4 Linux home

Use sdb as data backup and/or overflow. Sizes of root partitions really depend on how much software you expect to use. If you're going to use BTRFS for root, then double the size to 40GB or more. If you plan on building your own software, more than 18GB is probably a good idea for EXT4, and much more than 40GB for BTRFS.

joe_2000 08-23-2018 02:16 AM

Quote:

Originally Posted by fyzx92 (Post 5894608)
How does having an additional partition separately mounted solve the problem of overwriting config files if they're mostly saved in separate places anyways?

User-specific settings are stored in the user's home directory in files and/or directories starting with a . (which makes them hidden directories).
Discover them with
Code:

ls -halt ~
or by pressing ctrl-H in many file browsers. If the shortcut does not work look for "display hidden files" in the menus...

If you have a subdirectory in your home for data (or a symlink that points to one) then you don't have these "dotfiles" on your common home partition.
Does that explain?

Rickkkk 08-23-2018 07:28 AM

Quote:

Originally Posted by fyzx92 (Post 5894608)
Awesome! I was planning on keeping an empty partition that would be saved for windows, and I think with those tips, I can figure out how to install windows safely, and I'll be sure to look into it more when the time actually comes.

Some follow up questions to the data partition:
How does having an additional partition separately mounted solve the problem of overwriting config files if they're mostly saved in separate places anyways? (if too complicated to explain easily, that's fine)
Would it be possible for me to save some files in home (which would be visible only to linux, I assume?), and some in data (visible to both?)

@Rickkkk: to be clear, you're suggesting that I have an EFI partition in addition? Which would make the total list to be /, Windows OS, swap, data, /home, and EFI (550MiB according to ArchWiki)?
Edit: maybe a recovery partition too?

Hey fyzx92,

joe_2000 has answered your question concerning why a separate data partition solves the config files issue ... If you need more clarity, let us know.

In answer to your other questions:

Would it be possible for me to save some files in home (which would be visible only to linux, I assume?), and some in data (visible to both?)
  • Yes.
@Rickkkk: to be clear, you're suggesting that I have an EFI partition in addition? Which would make the total list to be /, Windows OS, swap, data, /home, and EFI (550MiB according to ArchWiki)?
Edit: maybe a recovery partition too?

  • You will *need* the ESP (EFI System Partition) if you have UEFI-only firmware or if you have hybrid (UEFI with legacy support) firmware set to UEFI-only mode. You would also only create an ESP when partitioning a GPT scheme (i.e. *not* an msdos/MBR type partition table ...). The ESP is where your *.efi files (boot loaders, in a sense) will reside and the only partition the UEFI-only firmware will see at startup (hence, required). As previously mentioned, this partition (ESP) has to be formatted as FAT32 and doesn't need to be very large .. Recommended minimum is usually around 250MB - I usually go with 550MB.

  • With respect to separate /boot and-or /home partitions in a given linux installation: this is largely a question of preference. I personally don't do this. The advantage of a separate /boot partition is becoming obsolete with the advent of UEFI firmware and GPT partitioning and separate /home partitions, while still potentially useful, are less necessary if one has a well-designed backup routine. ... So: your choice :) !

  • For swap, there are several alternatives and schools of thought. Whether you actually *need* to use swap space in linux depends on several factors: the amount of RAM you have, what you intend to run on the system, whether you intend to hibernate ... I suggest you read up on swap and get back to us with any specific questions. I notice that you have already consulted the Arch Linux wiki for other information, it is also an excellent resource in general, so you could start at its article on swap and go from there. Personally, I always create a separate swap partition, sized at the amount of physical RAM I have on the system + a few MB. Mostly, this is because these systems are laptops and I like to be able to hibernate.

  • As to the recovery (Windows) partition, in my experience, these are usually created by OEMs since physical installation media for Windows are no longer provided with new computers. I personally never create one - if required, I just reinstall (the most up to date version of ..) Windows, from a freshly created USB installer.
Check mrmazda's extensive recommendations in a previous post - very useful information there, as well as joe_2000's recent post with the answer to one of your questions.

Cheers - hope this helps - let us know how it goes !

fyzx92 08-23-2018 05:22 PM

Quote:

Originally Posted by mrmazda (Post 5894674)

If you're going the UEFI route, I suggest the following template:
Code:

sda1    320MB FAT EFI/ESP
sda2    100MB NTFS Windows reserved
sda3  48000MB NTFS Windows OS
sda4  96000MB NTFS Windows data
sda5  4100MB Linux swap
sda6  18000MB EXT4 Linux root #1 distro
sda7  18000MB EXT4 Linux root #2 alternate or version next distro
sda8  18000MB EXT4 Linux root #3 alpha/beta distro testing
sda9 275480MB EXT4 Linux home

Use sdb as data backup and/or overflow. Sizes of root partitions really depend on how much software you expect to use. If you're going to use BTRFS for root, then double the size to 40GB or more. If you plan on building your own software, more than 18GB is probably a good idea for EXT4, and much more than 40GB for BTRFS.

This is incredibly helpful! I just have one clarifying question: Is there any advantage to making the windows partitions now, or are those made automatically in unallocated space by windows at install time?

mrmazda 08-23-2018 06:01 PM

Advantage 1 in the overall long-term scheme of things is it can be advantageous to use a single partitioning application to do all partitioning.

#2 is it's to your personal mental advantage administratively that partition device names do not change unnecessarily if at all. If you don't create the Windows partitions before starting, existing ones are subject to change when they are created. If after installing Linux you decide you wish to alter the sizes created for the Windows partitions before installing Windows, you can delete and recreate them without causing name changes. If you really want to leave the freespace for Windows now, I suggest create the ESP, then immediately follow with all the Linux, so that the freespace is at the end. Or, go right ahead now and do ESP, then Linux, then all Windows following. With rotating rust, end of disk space is typically detectably slower than front and middle, giving first partitions a slight to modest performance advantage.

Personally, I object to allowing Windows to do anything automatically. :D

fyzx92 08-23-2018 07:29 PM

Yeah, that's kind of what I was assuming.

@ joe_2000, do you mean that one operating system is using /home for the config files whereas the other is using the data partition? If I wanted to have a partition for trying other distros (as I understood mrmazdas suggestion) would I need a separate data-like partition to separate those config files too?

joe_2000 08-24-2018 02:08 AM

Quote:

Originally Posted by fyzx92 (Post 5895030)
@ joe_2000, do you mean that one operating system is using /home for the config files whereas the other is using the data partition? If I wanted to have a partition for trying other distros (as I understood mrmazdas suggestion) would I need a separate data-like partition to separate those config files too?

No, that's not what I meant. Let's say your username in distro1 is joe. Then your home directory will be /home/joe. If you mount a separate partition under /home then everything in joe's home directory will be on that partition. If you then start using applications, they will put their configs into dotfiles under /home/joe. E.g. firefox would put its settings (profile etc.) under /home/joe/.mozilla.

Then you install another distro2, while reusing the username joe. You mount the same partition under /home as in distro1. You use firefox. Firefox will find that there is already a .mozilla directory in your user's home. At first sight, this might seem like a good thing, because right after install of distro2 you'll find all your browsing history, bookmarks etc. from distro1. But what happens if the two distro2 maintain different versions of firefox? What if their respective settings are incompatible? Ever noticed that upon a firefox upgrade, it tries to update your plugins? That means it modifies the user profile to match the new version, which might break it for another distro. The same logic applies for many other applications.

To solve this problem, my suggestion is not mounting a separate partition under home. That means that the directory /home/joe will have different contents between distro1 and distro2. Under /home/joe you will have a symlink that points to e.g. /mnt/data, which is the mountpoint for the data partition.
During normal usage, it will feel as if "data" was a subdirectory of /home/joe on both distros, and the content will be the same. That's where you documents, music etc. goes.

If you format the data partition in ntfs, you will also be able to see it from within windows, and it will not be "polluted" with configuration files from linux applications.

Let me know if it is still unclear.

mrmazda 08-24-2018 03:35 AM

Quote:

Originally Posted by jiajia (Post 5895143)
NOW, THE PROBLEM IS, For the data partition, is that where all my personal files would go or is that a place just for config files?

Just the opposite: config files go in /home/$USER/.*; other files go in the data partition (which I would be mounting to /home/data and/or /home/$USER/data, not /mnt).


All times are GMT -5. The time now is 11:44 AM.