Description:
- This section shows you how to actually partition your hard drive with the fdisk utility. Linux allows only 4 primary partitions. You can have a much larger number of logical partitions by sub-dividing one of the primary partitions. Only one of the primary partitions can be sub-divided.
- If partition size is more than 2 TB than you need to gdisk instead of fdisk. You need to convert from MBR to GPT you can do so (use caution with this) using gdisk.
Fdisk usage
- fdisk is started by typing (as root) fdisk device at the command prompt. device might be something like /dev/hda or /dev/sda
- The basic fdisk commands you need are:
- pprint the partition table
- ncreate a new partition
- ddelete a partition
- qquit without saving changes
- wwrite the new partition table and exit
- Create New Partition on Linux
- Start a terminal.
- Start fdisk using the following command:# fdisk /dev/sda
- In fdisk, to create a new partition, type the following command:n
- When prompted to specify the Partition type, type p to create a primary partition or e to create an extended one. There may be up to four primary partitions. If you want to create more than four partitions, make the last partition extended, and it will be a container for other logical partitions
- When prompted for the Number, in most cases, type 3 because a typical Linux virtual machine has two partitions by default.
- When prompted for the Start cylinder, type a starting cylinder number or press Return to use the first cylinder available.
- When prompted for the Last cylinder, press Return to allocate all the available space or specify the size of a new partition in cylinders if you do not want to use all the available space.
- By default, fdisk creates a partition with a System ID of 83. If you're unsure of the partition's System ID, use thelCommand to check it.
- Use thewCommand to write the changes to the partition table.
- Create a file system on the new partition. We recommend that you use the same file system as on the other partitions. In most cases it will be either the Ext4 or ReiserFS file system. For example, to create the Ext4 file system, enter the following command:# mkfs.ext4 /dev/sda3Or# mkfs -t ext4 /dev/sda3
- Create a directory that will be a mount point for the new partition and mount partition in that directory. For example, to name it data, enter:# mkdir /data# mount /dev/sda3 /data
- Make changes in your static file system information by editing the /etc/fstab file in any of the available text editors. For example, add the following string to this file:/dev/sda3 /data ext4 defaults 0 0Save /etc/fstab file after making changes
Gdisk Usage:
- Gdisk is use to create more than 2 TB partition because fdisk support up to 2 TB.
- The basic fdisk commands you need are:
- pprint the partition table
- ncreate a new partition
- ddelete a partition
- qquit without saving changes
- wwrite the new partition table and exit
- Method of create new partition will be same as fdisk.
No comments:
Post a Comment