第1步,添加新的磁盘分区
[root@db2 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 38770.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 318.9 GB, 8 bytes
255 heads, 63 sectors/track, 38770 cylinders
Units = cylinders of 16065 * 512 = bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3824 + 83 Linux
/dev/sda2 3825 7648 83 Linux
/dev/sda3 7649 8668 82 Linux swap / Solaris
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (8669-38770, default 8669):
Using default value 8669
Last cylinder or +size or +sizeM or +sizeK (8669-38770, default 38770): +100G
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16:
Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@db2 ~]#
第2步,使用工具partprobe让kernel读取分区信息
[root@db2 ~]# partprobe
使用fdisk工具只是将分区信息写到磁盘,如果需要mkfs磁盘分区则需要重启系统,
而使用partprobe则可以使kernel重新读取分区 信息,从而避免重启系统。
第3步,格式化文件系统
[root@db2 ~]# mkfs.ext3 /dev/sda4
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
inodes, blocks
blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=
746 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, , , , , , ,
, , , , ,
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@db2 ~]#
第4步,mount新的分区/dev/sda4
[root@db2 ~]# e2label /dev/sda4 /data
[root@db2 ~]# mkdir /data
[root@db2 ~]# mount /dev/sda4 /data
[root@db2 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 14% /
/dev/sda2 41% /oracle
tmpfs 0 0% /dev/shm
/dev/sda4 1% /data
[root@db2 ~]#
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/176515.html原文链接:https://javaforall.net
