# howto partioning your hard drive ?



## krakator (Aug 7, 2011)

Hello everyone,
I started with FreeBSD and Linux from the world, in my installations the installation process was as follows:
(200 mo)-> /
(200 go) ->/home
(100mo)->/root
(4go)->/swap
(2go)->/tmp
(50go)->/usr
(10go)->/usr/local
(2go)->/var
/ech
nb: all partition are on ext4

To better understand my needs:
I wish to create a workstation with an exchange Â«/ech*beep*Â»*beep* with windows 7/64bits

would like your opinion on this type of partitioning in bsd especially the notion of slice is still unclear, is it useful to do so?
I want to use KDE as graphical environment.
Knowing that a jail in ''virtualbox'' with xp would be welcome.

Merci d'avance.


----------



## ikreos (Aug 7, 2011)

Basically a slice is an MS-DOS partition that you further divide into your FreeBSD "partitions". Someone else can probably explain it better than me.

Here's what my setup looks like.


```
df -h

Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/ufs/froot        1.9G    413M    1.4G    23%    /
/dev/ufs/fvar         1.9G    104M    1.7G     6%    /var
/dev/ufs/fusrsrc      1.9G    535M    1.3G    29%    /usr/src
/dev/ufs/fusrlocal     39G    4.3G     31G    12%    /usr/local
/dev/ufs/fhome        194G     55G    123G    31%    /home
tmpfs                 5.5G    116M    5.4G     2%    /tmp
tmpfs                 5.8G    400M    5.4G     7%    /usr/local/ports/wrkdir
```

/ - Contains the entire base system minus the source (includes /root and /usr).
/var - Really depends on how many programs are going to write to it. I would say 2-4 GB for a workstation.
/usr/src - I have a separate partition for the system sources and a tmpfs (not shown) mount point for when I'm building it.
/usr/local - Since this is where all third party software is installed I gave it a healthy 40 GB. It all depends on how much software you plan to install.
/home - Whatever was left after all the other partitions.
/tmp - To reduce disk usage I placed /tmp on a tmpfs filesystem.
/usr/local/ports/wrkdir - This is one I added to build ports to reduce disk usage and hopefully speed up compilation.

I also have a 4 GB swap partition but swap size is up to you.

I also linked /usr/ports to /usr/local/ports to keep / from getting cluttered. I linked /usr/compat to /usr/local/compat for the same reason.

FreeBSD does not natively use the Ext4 filesystem that's a Linux thing. UFS or ZFS is the choice for FreeBSD. If you want to be able to exchange files between *BSD, Linux, and Windows, I would make another partition and format it Fat32 for that. Or just use a thumb drive.

Since you want to use KDE I would recommend trying PC-BSD.


----------



## aragon (Aug 7, 2011)

In FreeBSD it's traditional to have at least 3 file systems: /, /usr, and /var.  There should be no /home file system - that ought to be a symlink to where your home directories actually are, which is usually /usr/home.

I suggest you don't have more than the above 3 traditional partitions until you're more familiar with FreeBSD.

A /root file system looks utterly pointless.


----------



## wblock@ (Aug 7, 2011)

krakator said:
			
		

> Hello everyone,
> I started with FreeBSD and Linux from the world, in my installations the installation process was as follows:
> (200 mo)-> /
> (200 go) ->/home
> ...



That's pretty complicated.  Some people like complication, but it can make things harder to use.  ext4 is another unnecessary complication; FreeBSD is not Linux.

Suggestion:

1G /
4G swap
4G /var
45G /usr

All UFS except swap.  Use remaining space to create a VFAT partition if you want to exchange data with Windows.



> To better understand my needs:
> I wish to create a workstation with an exchange Â«/ech*beep*Â»*beep* with windows 7/64bits



Even better reason to keep it simple.  You will also likely have to use GPT because Windows 7 uses it.  Important: make a full backup of the hard drive before changing partitioning.  Clonezilla is handy for that.



> would like your opinion on this type of partitioning in bsd especially the notion of slice is still unclear, is it useful to do so?



"slice" is what FreeBSD calls an MS-DOS partition.  That's all.



> I want to use KDE as graphical environment.



PC-BSD is probably the easiest way to get there.



> Knowing that a jail in ''virtualbox'' with xp would be welcome.



Should work.  You might even skip all the partition changing and just run FreeBSD from a VirtualBox VM on Windows 7.


----------



## d_mon (Aug 7, 2011)

*4gb* of swap is exaggerated!


----------



## wblock@ (Aug 7, 2011)

d_mon said:
			
		

> *4gb* of swap is exaggerated!



Not if you build Firefox with optimized CFLAGS.


----------



## fonz (Aug 7, 2011)

d_mon said:
			
		

> *4gb* of swap is exaggerated!


Rules for how much swap space you need are not set in stone, it depends very much on the situation: what the computer is going to do, how much memory that requires on average, how much it needs under a heavy load and how much RAM is in the system, to name but a few factors.

Fonz


----------



## jem (Aug 7, 2011)

aragon said:
			
		

> There should be no /home file system



Why?  I always create a seperate home.



			
				aragon said:
			
		

> A /root file system looks utterly pointless.



Agreed.  Root's home directory should be part of the root filesystem so that it is immediately available if you have to boot into single user mode.


These days, now that I use ZFS almost exclusively, I pretty much keep my entire FreeBSD OS inside a single dataset, with additional datasets for homedirs and non-OS data.  Before that, my UFS partition layout usually looked something like this:


```
ad0s1a  /       1GiB
ad0s1b  swap    2x physical RAM
ad0s1d  /var    1GiB
ad0s1e  /tmp    1GiB
ad0s1f  /usr    10GiB
ad0s1g  /home   remainder of disk
```

This served me well for general use, but specific requirements might demand a larger /var, for example a mail server, or a larger /usr if you're expecting to install many ports or packages.

Remember thought that suggested disk partitioning schemes are, like a lot of things, largely down to personal opinion.


----------



## fonz (Aug 7, 2011)

jem said:
			
		

> Why?  I always create a seperate home.


As do I. Both approaches are ok and there are no reasons why either would be a bad idea.



			
				jem said:
			
		

> Agreed.  Root's home directory should be part of the root filesystem so that it is immediately available if you have to boot into single user mode.


Besides, there should be nothing big in there anyway. Just make it part of the root filesystem / indeed.

Fonz


----------



## wblock@ (Aug 7, 2011)

fonz said:
			
		

> Rules for how much swap space you need are not set in stone, it depends very much on the situation: what the computer is going to do, how much memory that requires on average, how much it needs under a heavy load and how much RAM is in the system, to name but a few factors.



Another is the size of the disk.  With about ~60G of space in the example, devoting 7% of that to swap is not costly.  If it was going on an 8G USB stick, that's a different matter.


----------



## UNIXgod (Aug 7, 2011)

Always a good read is tuning()

This should give you an idea how the file hier()archy is used for different applications and file system usage.


----------

