LINUX /根目录扩展分区
2015-08-23 23:35
639 查看
1、SDA总共20G,目前只用到了10G
[root@rac2 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1019 8185086 83 Linux
/dev/sda2 1020 1038 152617+ 82 Linux swap / Solaris
/dev/sda3 1039 1305 2144677+ 83 Linux
2、将剩下的空间创建一个主分区
[root@rac2 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 2610.
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): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (1306-2610, default 1306):
Using default value 1306
Last cylinder or +size or +sizeM or +sizeK (1306-2610, default 2610):
Using default value 2610
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@rac2 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1019 8185086 83 Linux
/dev/sda2 1020 1038 152617+ 82 Linux swap / Solaris
/dev/sda3 1039 1305 2144677+ 83 Linux
/dev/sda4 1306 2610 10482412+ 83 Linux
3、格式化分区,并挂载到根目录相应的目录下。我这里挂载到/u01下。
[root@rac2 ~]# mkfs -t ext3 -c /dev/sda4
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2620603 blocks
131030 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rac2 ~]# mount /dev/sda4 /u01
[root@rac2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.6G 4.9G 2.4G 68% /
/dev/sda3 2.0G 263M 1.7G 14% /home
tmpfs 998M 0 998M 0% /dev/shm
/dev/sda4 9.9G 151M 9.2G 2% /u01
4 开机启动挂载
[root@rac2 ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/home/swap swap swap defaults 0 0
/dev/sda4 /u01 ext3 defaults 0 0
[root@rac2 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1019 8185086 83 Linux
/dev/sda2 1020 1038 152617+ 82 Linux swap / Solaris
/dev/sda3 1039 1305 2144677+ 83 Linux
2、将剩下的空间创建一个主分区
[root@rac2 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 2610.
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): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (1306-2610, default 1306):
Using default value 1306
Last cylinder or +size or +sizeM or +sizeK (1306-2610, default 2610):
Using default value 2610
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@rac2 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1019 8185086 83 Linux
/dev/sda2 1020 1038 152617+ 82 Linux swap / Solaris
/dev/sda3 1039 1305 2144677+ 83 Linux
/dev/sda4 1306 2610 10482412+ 83 Linux
3、格式化分区,并挂载到根目录相应的目录下。我这里挂载到/u01下。
[root@rac2 ~]# mkfs -t ext3 -c /dev/sda4
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2620603 blocks
131030 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rac2 ~]# mount /dev/sda4 /u01
[root@rac2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.6G 4.9G 2.4G 68% /
/dev/sda3 2.0G 263M 1.7G 14% /home
tmpfs 998M 0 998M 0% /dev/shm
/dev/sda4 9.9G 151M 9.2G 2% /u01
4 开机启动挂载
[root@rac2 ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/home/swap swap swap defaults 0 0
/dev/sda4 /u01 ext3 defaults 0 0
相关文章推荐
- /var/log目录中Linux日志文件的功能详解
- CentOS基本命令学习
- centos安装scrapy
- Linux多线程如何避免死锁
- Linux用户与用户组
- 关于一些Linux命令的格式及用法(Linux就业班第二次作业)
- linux下结合sqlite3做一个英语查询字典小项目 <1>
- Spark修炼之道(基础篇)——Linux大数据开发基础:第四节:Linux文件系统(二)
- Linux学习日记--基础命令(2)--文件查看,命令历史,命令展开
- Linux命令:head,tail命令使用方法
- CentOS7 安装boost
- 玩转linux第三天之history、alias、unalias 、mkdir、rmdir、tree命令(一)
- Linux串口编程详解
- linux帮助相关命令man、info、help
- Linux麒麟下金仓数据库配置ODBC数据源
- Linux命令:ls命令使用方法
- linux延时函数
- linux修改环境变量
- centos6.5 postgresql-9.4下数据库的迁移
- linux内核编译