If after you installed the CentOS server, you find you need to resize your partition or add new partition from unallocated disk space, you can follow this post http://www.linuxtopia.org/online_books/centos_linux_guides/centos_enterp....
- Turn off the swap space on the device that you are going to create a new partition. To do that, check which partition is swap in
/etc/fstab, and run something like "swapoff /dev/sdb1" (if /dev/sdb1 is a swap on /dev/sdb).
- Start parted, where /dev/sda is the device on which to create the partition:
# /sbin/parted /dev/sda
- View the current partition table to determine if there is enough free space:
(parted) print
- Make the partition. From the partition table, determine the start and end points of the new partition and what partition type it should be. You can only have four primary partitions (with no extended partition) on a device. If you need more than four partitions, you can have three primary partitions, one extended partition, and multiple logical partitions within the extended.
For example, to create a primary partition with an ext3 file system from 1024 megabytes until 2048 megabytes on a hard drive type the following command:
(parted) mkpark primary ext3 1024 2048
- After creating the partition, use the print command to confirm that it is in the partition table with the correct partition type, file system type, and size.
(parted) print
- Now quit parted:
(parted) quit
- Review the output of /proc/partitions and remember the minor number of the new partition so that you can label it.
# cat /proc/partitions
- Format the partition
# /sbin/mkfs -t ext3 /dev/sda6
- Labeling the Partition
# /sbin/e2label /dev/sda6 /data1
- Creating the Mount Point
# mkdir /data1
- Add to /etc/fstab
LABEL=/data1 /data1 ext3 defaults,nodev 1 2
The first column should contain LABEL= followed by the label you gave the partition. The second column should contain the mount point for the new partition, and the next column should be the file system type (for example, ext3 or swap). If you need more information about the format, read the man page with the command man fstab.
If the fourth column is the word defaults, the partition is mounted at boot time. To mount the partition without rebooting, as root, type the command:
# mount /data1
- Reboot the server and use "df -h" to see whether the new partition has been mounted. If not, you have some work to do, poking around, and check if you made any mistake.
This post should work for other Linux distro too. If you don't have parted installed, then you can use "fdisk".
Recent comments
8 weeks 6 days ago
9 weeks 5 days ago
20 weeks 4 days ago
22 weeks 14 hours ago
30 weeks 5 days ago
31 weeks 7 hours ago
31 weeks 6 days ago
32 weeks 5 days ago
32 weeks 6 days ago
33 weeks 7 hours ago