Using fdisk to create a partition
1.Type fdisk -l to view a list of all the partitions on all hard drives. Notice the empty hard drive (/dev/sdb) where no partitions are defined.
2.Type fdisk /dev/sdb to open the Linux fdisk program with the second hard drive as the target.
3.Type n to create a new partition on the drive.
4.Type p to designate the new partition as a primary partition. e can be selected if an extended partition needs to be created.
5.Type 1 to create the first partition on the hard disk. To create other partitions, type the appropriate number.
6.Type 1 to start the new partition on the first hard drive cylinder. When adding more partitions, the first cylinder available will be the default.
7.Type 1 and press [Enter] to start the new partition on the first hard drive cylinder. When adding more partitions, the first available cylinder will be the default. Type in the last cylinder or define the size of the new partition by typing +500M for a 500mb partition. Substitute the number for your desired partition size. Press [Enter] when finished.
8.Type t to set the partition type.
9.Type 1 to signify the partition that needs the partition type assigned. Next, type the hex partition identifier for the new partition. Type L to get a list of available partition types, if the partition hex number isn't known.
10.Notice that the Linux native partition type is 83 and the Linux swap partition type is 82.
11.Type 83 to set the partition hex code to Linux native.
12.Type w to write the new partition information to the MBR of the hard drive.
The partition configuration in fdisk is done in memory. Nothing is written to the MBR of the hard drives until the w command is issued.
Creating a Filesystem
13.Type mkfs -t ext2 /dev/sdb1 to create an ext2 filesystem on the first partition of the second hard drive. Substitute the drive and partition numbers if working with a partition other than /dev/sdb1.
Converting to ext3 - a partition must be an ext2 partition before converting it to ext3. After creating the ext2 partition, type tune2fs -j [device-partition]. This will convert the partition to ext3. From this point on, the partition will need to be mounted as ext3 for journaling functionality.
14.Type mkdir /mnt/data to create a new mount point for the new partition.
15.Type mount /dev/sdb1 /mnt/data to mount the partition. Substitute the drive, partition numbers and mount point if working with a partition other than /dev/sdb1 and /mnt/data.
16.Add an entry in the /etc/fstab file to mount the partition automatically on bootup.
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073