Posts Tagged ‘partition’

By using GParted (GNOME Partition Editor)
It’s actually the easiest way to partition a disk.

You can access it on a live cd by clicking Systems > Administrator > GParted before the installation process. Or download, install, then run it after installation.

By fdisk command
Type fdisk command in the command line.
syntax: fdisk [device]
e.g. : fdisk /dev/sda

The basic commands needed are:
p – print the new partition table
n – create a new partition
d – delete a partition
q – quit without saving changes
w – write the new partition and exit
It is important to enter the w command for changes to take effect.

By using cfdisk
Type cfdisk command in the command line.
syntax: cfdisk [device]
e.g. : cfdisk /dev/sda

The difference of cfdisk from fdisk is it has a user interface. The partition table is listed and command buttons are located on the bottom of the screen. Use the arrow keys to change between partitions and commands.

fdisk and cfdisk commands are root user commands. But it is recommended to execute this commands from a non-root user. The root user can access important files on your system and it is important to secure those files. It is actually a bad idea to log-in as a root user. To execute a root user command from another user, use the sudo command. The sudo allows temporary access to run commands that would not normally be executed due to file permission restrictions. As an example, type sudo fdisk /dev/sda or sudo cfdisk /dev/sda. More of sudo in the upcoming article. 🙂

This may sound boring but it is important to take note  the Linux File System. I pasted a screenshot of the sub directories of the root directory in Linux. You may check http://tldp.org/LDP/intro-linux/html/intro-linux.html for details.

root-subdirectories

root-subdirectories

It is important to plan your Linux partition. Why partition? To achieve higher data security in case of disaster. You can partition your hard disk to a maximum of four partitions and you could even extend it. i386 systems can be sliced up to fifteen to sixty three partitions. For this to become possible, one of the primary partition should become an extended partition and logical partitions should be added to it. Sound confusing? It looks like this:

/dev/hda1 –> primary
/dev/hda2 –> extended
—   /dev/hda5 –> logical
—   /dev/hda6 –> logical
—   /dev/hda7 –> logical
—   /dev/hda.. –> logical

Note: Logical partition always starts from hda5.

Recommended partition:

Swap
This is the space on the hard drive that can be used as a virtual memory. Linux have a maximum of 2GB swap limit. The traditional swap space value is twice the physical RAM. You can increase or decrease it or enter any value you prefer. Or you may not use any swap partition at all, as long as your system have a higher physical RAM.

The root file system (/)
This is the top of the directory tree and it contains Linux and all Linux installation files. The size of the root partition will vary depending on what you plan to install.

/home
This is the directory where your data are stored. It is roughly equivalent to the “My Documents” folder on a MS Windows desktop.

Or another recommendation would be:
sda1   –>   /boot
sda5   –>   /
sda6   –>   /home
sda7   –>  /usr
sda8   –>   /var
sda9   –>   /tmp
sda10 –>  swap

On  servers, system data tends to be separated from user data. Here is the recommended partition for a server system:
– a partition with all data necessary to boot the machine
– a partition with configuration data and server programs
– one or more partitions containing the server data such as database tables, user mails, an ftp archive etc.
– a partition with user programs and applications
– one or more partitions for the user specific files (home directories) •
– one or more swap partitions (virtual memory)

It will still depend upon you on how you’ll partition a system. These are just recommendations. Once partitions are made, you can only add more. Changing sizes or properties of existing partitions is even possible but not advisable.