Best way to organize hard disks?

I’m new to Linux, so I installed v. 11.2 on an old computer to get the hang of it. Now I want to install on my main computer and have a couple of question, mainly around how to use partitions in a Linux way instead of how I did under Windows.

  1. Under Windows I had two partitions (actually two drives): one for the OS and one where I installed everything. I was thinking of three for Linux: the first for the OS, the second for a swap file, and the third for everything else (data files, the programs I install, etc.). Is this a common approach? The idea is to allow me to wipe the OS and start over while keeping as much of the stuff that doesn’t come with the OS on a separate drive. Worked OK on Windows (except for the registry, of course, which was always a pain, but lets not go there - I’m off Windows). Which directories hold non-OS stuff? Looks like everything in /home could be in the third partition, but would /usr go there, too? (seems a lot of programs install there). What’s the best way to make use of a second hard physical hard drive?
  2. Is it possible to mount more than one directory (say, /usr and /home) on a separate (single) partition during install or after installation? It seems that moving a directory to another partition causes the whole partition to be used by that directory (at least during installation).
  3. Just curious - when installing a .rpm, is there any way to control where it is installed?
  4. Given the Linux directory hierarchy, when you download a tarball for compiling and installing, where do you put it? I’ve been using /home. Most other directories seem to be read-only to everyone but superuser. Do I need to log on as superuser in order to install something? I thought that should only be done when configuring the OS or something.

I guess I’m trying to understand how good Linux users organize their hard disk space. Do most people have one big partition for everything, or break it down into multiple partitions – and if so, how do you break it down?

I’m really open to any best practice suggestions.

Thanks in advance!

Usually it works like this:
/ is root, where all the core OS files go
/home is for personal files
I would just stuck to openSUSE’s default installation, root, home and swap, no need to complicate things

  1. Is it possible to mount more than one directory (say, /usr and /home) on a separate (single) partition during install or after installation? It seems that moving a directory to another partition causes the whole partition to be used by that directory (at least during installation).

Dont know this one that well, I guess you can but i dont do complicated ****

  1. Just curious - when installing a .rpm, is there any way to control where it is installed?

Not really

  1. Given the Linux directory hierarchy, when you download a tarball for compiling and installing, where do you put it? I’ve been using /home. Most other directories seem to be read-only to everyone but superuser. Do I need to log on as superuser in order to install something? I thought that should only be done when configuring the OS or something.

You can install packages you compiled no problem, no need for root logins

I guess I’m trying to understand how good Linux users organize their hard disk space. Do most people have one big partition for everything, or break it down into multiple partitions – and if so, how do you break it down?

Just root, home and swap for me

I’m really open to any best practice suggestions.

Well you can partition the drive any way you like really, just remember you can only have four main paritions… this is not a linux limit its a hard drive limit.
But you could use extended partitions, but its risky

Thanks in advance!

Your welcome

Under Linux, you can either use a swap file (which doesn’t require a separate partition) or a swap partition. The best approach is to use a swap partition whenever it’s possible.

Which directories hold non-OS stuff? Looks like everything in /home could be in the third partition, but would /usr go there, too? (seems a lot of programs install there).

Despite its name, /usr is not meant for “users” but for applications. Everything you’re going to install is going to land here.

What’s the best way to make use of a second hard physical hard drive?

Unless you’re going to make a raid0 (faster) or a raid1 (safer), there is no significant advantage. Of course you can split a Linux installation into two (or more) harddrives and have separate partitions for /var /tmp /usr/local /home /srv /boot. But I doubt you will see a difference in term of performance (unless it really matters to you).

  1. Is it possible to mount more than one directory (say, /usr and /home) on a separate (single) partition during install or after installation?

Not sure I understand. You can have /usr and /home in separate partitions or not. Once you have made your choice, you cannot change that anymore. (well … you could but maybe not today).

  1. Just curious - when installing a .rpm, is there any way to control where it is installed?

As soon as you know the package name, yes. Example :


rpm -ql MozillaFirefox

  1. Given the Linux directory hierarchy, when you download a tarball for compiling and installing, where do you put it?

Most Linux users don’t compile nowadays. :frowning:
Under openSUSE, rpm packages land in /var/cache/zypp/packages. BTW having /var on another disk is a possibility.

Do I need to log on as superuser in order to install something?

No. You can also type “sudo” before any command to run this command as root.

I guess I’m trying to understand how good Linux users organize their hard disk space. Do most people have one big partition for everything, or break it down into multiple partitions – and if so, how do you break it down?

It’s a philosophical question. And so you’re going to get different answers. Here’s how I usually do:


Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb6             4.1G  578M  3.4G  15% /
/dev/sdb7              16G  7.6G  7.4G  51% /usr
/dev/sda10             35G  384M   32G   2% /home
/dev/sdb8             6.0G  640M  5.0G  12% /var
/dev/sdb9             7.9G  212M  7.3G   3% /local
/dev/sdb10            124G   83G   41G  68% /srv
/dev/sdb11            4.0G  169M  3.6G   5% /tmp

  • swap is not a “mounted” filesystem. So it doesn’t appear in that listing.

/
/home
/swap

That is really all the average person needs. This will allow you to install another version or a newer version in that / directory without formatting /home, so you keep your stuff. If you leave some free space available, you can even install another distro beside openSUSE and it will use your same /home and /swap. :slight_smile: Just give about 20 GB of space for each / that you need.

Just like please_try_again said, there is no need to complicate things. It really is that simple.

You should compile/install you own programs under /usr/local. /usr/local is also the default destination in most sources packages.
Some people like to have /usr/local in a separate partition (so they won’t reformat that one if they reinstall a system).

I you heard me saying that, I was probably drunk. lol!

Try to understand this: SDB:Basics of partitions, filesystems, mount points - openSUSE

Sorry - I’ve been away and didn’t reply earlier. Thanks for the many posts. They helped!

I recommend making a small 200MB /boot partition and formatting it with ext3. This way your boot files will be safe at all times. Other then that you need at least a seperate root (/) and /home partition. Since all “good” user-programs write their configuration to your home directory this will allow you to easily change linux operating systems.

Given the Linux directory hierarchy, when you download a tarball for compiling and installing, where do you put it?

You put it in some place where you have permission to write as user. This could be a place like /home/username/packages/

Never compile as root. This is bad and - in some cases - even makes the compile to fail. This is the reason why you should NOT compile in /usr/local/ as has been suggested. There you would need to be root to write and compiling means writing.

Then, when everything is compiled, there is the final step of installing. This (and only this) must be done as root. I use

su -c ‘make install’

for this step. I usually have disabled the permission for sudo to execute make. Letting everyone write a Makefile and execute it as root would be way too dangerous.

During the ./configure step I force the installation to go to /usr/local/ because SUSE things are in /usr/. This way I can always tell what was compiled from source and what was installed from the rpm’s. Whenever you have installed a library don’t forget to run ‘ldconfig’ as root.

That’s it. Very easy once you have done it twice.