Creating new partition on Linux
posted by PRAJEETH on JUN 02, 2015 under
LINUX
Once a virtual disk file has been added to virtual machine, the new disk has to be added to system
and then formatted for it to be used. The below steps show you how.
Visit my earlier post to see how virutal disk can be added to virutal machine.
The system is a Linux 5.3 Red Hat virutal machine running on VMWare Workstation 9.0
Currently, the machine has two disks :
/dev/sda
/dev/sdb
Sceen 1
Execute fdisk -l to see the list of disks connected to system.
The message
"Disk /dev/sdc doesn't contain a valid partiton table" implies that the disk is a raw disk.
Sceen 2
To partition the raw disk, execute fdisk
on the raw disk. As in here, fdisk /dev/sdc
Enter m to print the list options.
Enter n to create a new partition.
Choose e if the partition you are creating is an extended partition
or choose p if it is a primary partition.
Provide the size of the partition in megabytes or number or partition.
Choose w to update the partition table with new partition.
Sceen 3
Executing fdisk shows the new disk /dev/sdc as having a single partition with size
6442 MB and having ID 83. ID 83 is assumed by ext2, ext3, ext4, rasierfs on a Linux system. ID 82 is a Linux
Swap file system.
Sceen 4
Format the partition /dev/sdc1 with ext3
using mkfs command.
Sceen 5
Create a mount point which is essentially a directory or a sub-directory
Sceen 6
Mount the new partition on to the newly created mount point using
mount command
Sceen 7
mount
will not automatically add entry in /etc/fstab
Sceen 8
Correctly add the entry in
/etc/fstab so that the partition will be
mounted automatically across reboots.
Sceen 9
The /etc/fstab shows the new entry for
/dev/sdc1 and /etc/mtab shows the new partition.
Sceen 10
Reboot the machine using init 6
Sceen 11
Rebooting is underway
Sceen 12
df -h shows the space statitics for /dev/sdc1
Sceen 13
Grant the necessary ownership and permission to new partition.
Sceen 14