Difference between revisions of "Partitions setup"

(Created page with "How to setup the partitions are a key point in Linux installation process. There are many school regarding that: * More partitions will bring more control and avoid memory le...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Linux]]
 
How to setup the partitions are a key point in Linux installation process.
 
How to setup the partitions are a key point in Linux installation process.
  
Line 36: Line 37:
 
| fat32 || /boot || 150 Mo || primary || boot
 
| fat32 || /boot || 150 Mo || primary || boot
 
|-
 
|-
| ext4 || / || 50 Go || primary || boot
+
| ext4 || / || 50 Go || primary ||
 
|-
 
|-
 
| swap ||  || 8 Go || primary ||
 
| swap ||  || 8 Go || primary ||
Line 65: Line 66:
 
| ext4 || /tmp || 4 Go || logical
 
| ext4 || /tmp || 4 Go || logical
 
|}
 
|}
 +
 +
 +
 +
=Advanced=
 +
 +
 +
 +
==How to know the current hardware and partitions?==
 +
 +
You can always have a list of available hardware and partitions by checking-out /dev.
 +
 +
<syntaxhighlight lang="bash">
 +
ls /dev/
 +
</syntaxhighlight>
 +
 +
You'll see some output.
 +
 +
>> Hardware = letter
 +
 +
>> Partition = number
 +
 +
 +
* /dev/sd'''a'''
 +
** /dev/sda''1''
 +
** /dev/sda''2''
 +
** /dev/sda''3''
 +
* /dev/sd'''b'''
 +
** /dev/sdb''1''
 +
* /dev/sd'''c'''
 +
** /dev/sdc''1''
 +
** /dev/sdc''2''
 +
 +
 +
 +
As an alternative, you can run the fdisk command:
 +
 +
<syntaxhighlight lang="bash">
 +
sudo fdisk -l
 +
</syntaxhighlight>
 +
 +
 +
Then you'll see more details like:
 +
 +
<syntaxhighlight lang="bash">
 +
Disk /dev/sda: 128.0 GB, 128035676160 bytes
 +
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
 +
Units = sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
Disk identifier: 0x000ea115
 +
 +
  Device Boot      Start        End      Blocks  Id  System
 +
/dev/sda1  *        2048  233390079  116694016  83  Linux
 +
/dev/sda2      233392126  250068991    8338433    5  Extended
 +
/dev/sda5      233392128  250068991    8338432  82  Linux swap / Solaris
 +
 +
Disk /dev/sdb: 4043 MB, 4043309056 bytes
 +
255 heads, 63 sectors/track, 491 cylinders, total 7897088 sectors
 +
Units = sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
Disk identifier: 0x00845e69
 +
 +
  Device Boot      Start        End      Blocks  Id  System
 +
/dev/sdb1  *        2048    7897087    3947520    c  W95 FAT32 (LBA)
 +
</syntaxhighlight>
 +
 +
 +
 +
==How to know the current mount points==
 +
 +
On *Ubuntu Desktop all the devices are automatically mounted. This is not the case on the servers!
 +
 +
 +
To check the list of current mount points:
 +
 +
<syntaxhighlight lang="bash">
 +
sudo mount
 +
</syntaxhighlight>

Latest revision as of 15:29, 7 August 2014

How to setup the partitions are a key point in Linux installation process.

There are many school regarding that:

  • More partitions will bring more control and avoid memory leaks to spread out
  • Less partitions are easier to manage


In all cases

In all cases, you need at least 2 partitions:

  • 1 data partition called root (/)
  • 1 temporary partition called "swap". This is the temporary data of the system.


The swap size depends on your RAM:

  • Up to 4 Go RAM: double your RAM value
  • 8 to 16 Go RAM: put the same amount as your RAM
  • more than 16 Go RAM: that's hard to evaluate. 16 Go of swap is already a lot! That should be enough in all cases.


Desktop installation

For a desktop installation you can use the default partitionning table. This is generally good enough.

Some developers - like me - are used to put "/opt" in a dedicated space.


This is my partition table:

File System Mount point Size Type Flags
fat32 /boot 150 Mo primary boot
ext4 / 50 Go primary
swap 8 Go primary
ext4 /home 400 Go logical


Server installation

Unlike a workstation, it's quite important to setup some partitions on a server. This will avoid to have to many logs or temp files - for instance. Then you'll have to monitor regulary the matching mount points to check the available space.


This is how I setup my servers:

File System Mount point Size Type
ext4 / 50 Go primary
swap 8 Go primary
ext4 /home 424 Go primary
ext4 /var/log 2 Go logical
ext4 /tmp 4 Go logical


Advanced

How to know the current hardware and partitions?

You can always have a list of available hardware and partitions by checking-out /dev.

ls /dev/

You'll see some output.

>> Hardware = letter

>> Partition = number


  • /dev/sda
    • /dev/sda1
    • /dev/sda2
    • /dev/sda3
  • /dev/sdb
    • /dev/sdb1
  • /dev/sdc
    • /dev/sdc1
    • /dev/sdc2


As an alternative, you can run the fdisk command:

sudo fdisk -l


Then you'll see more details like:

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ea115

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   233390079   116694016   83  Linux
/dev/sda2       233392126   250068991     8338433    5  Extended
/dev/sda5       233392128   250068991     8338432   82  Linux swap / Solaris

Disk /dev/sdb: 4043 MB, 4043309056 bytes
255 heads, 63 sectors/track, 491 cylinders, total 7897088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00845e69

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048     7897087     3947520    c  W95 FAT32 (LBA)


How to know the current mount points

On *Ubuntu Desktop all the devices are automatically mounted. This is not the case on the servers!


To check the list of current mount points:

sudo mount