Wednesday, 31 October 2012

Creating Partitions

Creating Partitions

You can create partitions using command line. But firstly you should know what is the current partitioning table, for that

#fdisk -l

# df -h

These command will show you the existing partitions and where these partitions are mounted. In linux, mounting the partitioning is very necessary because without mounting the partitions you can't use the partition space. There are two ways of mounting the partitions. One is permanent way and other is temporary way.

To create the partition use the following command:

# fdisk /dev/sda

press m for more options, and press n for new partition, then press enter for initial address and enter +2G as last address. This will create 2GB partition. Then press w and write the partitioning table.

After that reboot the machine to work your partitions well.

This will create the new partition. But this new partition is not in use so far. For that create a new directory using

# mkdir /movies

Now mount the new partition on the directory.

For temporary mount:

# mount /dev/sda5 /movies

where sda5 is the new partition created. In your case the number may vary. Now check the mount using :

# df -h

For permanent mounting the partition, make entry in file

# vim /etc/fstab

/dev/sda5 movies ext4 defaults 0 0

The permanent mounted partition lasts after the reboot also as temporary partition doesn't.

No comments:

Post a Comment