LINUX /根目录扩展分区

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值