码迷,mamicode.com
首页 > 其他好文 > 详细

利用fdisk将硬盘剩余空间进行分区

时间:2015-03-02 15:02:21      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:fdisk

1.首先查看分区,发现300多G的硬盘/dev/sdc1只使用了200多G而已

[root@local103 dbbackup]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda2              16G  9.6G  5.1G  66% /

/dev/sda1              99M   19M   76M  20% /boot

tmpfs                1006M   22M  984M   3% /dev/shm

/dev/sdb1              79G   39G   37G  52% /disk1

/dev/sdc1             197G  173G   15G  93% /disk2

[root@local103 dbbackup]# 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          13      104391   83  Linux

/dev/sda2              14        2088    16667437+  83  Linux

/dev/sda3            2089        2610     4192965   82  Linux swap / Solaris


Disk /dev/sdb: 85.8 GB, 85899345920 bytes

255 heads, 63 sectors/track, 10443 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1       10443    83883366   83  Linux


Disk /dev/sdc: 322.1 GB, 322122547200 bytes

255 heads, 63 sectors/track, 39162 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1       26108   209712478+  83  Linux

2.进行分区

[root@local103 dbbackup]# fdisk /dev/sdc

The number of cylinders for this disk is set to 39162.

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

Partition number (1-4): 2

First cylinder (26109-39162, default 26109): 回车(仔细看就会发现这个是sdc1结束扇区+1的值

Using default value 26109

Last cylinder or +size or +sizeM or +sizeK (26109-39162, default 39162): 回车

Using default value 39162


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@local103 dbbackup]# partprobe

[root@local103 dbbackup]# 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          13      104391   83  Linux

/dev/sda2              14        2088    16667437+  83  Linux

/dev/sda3            2089        2610     4192965   82  Linux swap / Solaris


Disk /dev/sdb: 85.8 GB, 85899345920 bytes

255 heads, 63 sectors/track, 10443 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1       10443    83883366   83  Linux


Disk /dev/sdc: 322.1 GB, 322122547200 bytes

255 heads, 63 sectors/track, 39162 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1       26108   209712478+  83  Linux

/dev/sdc2           26109       39162   104856255   83  Linux


[root@local103 dbbackup]# mkfs.ext3 /dev/sdc2 

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

13107200 inodes, 26214063 blocks

1310703 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

800 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, 2654208, 

4096000, 7962624, 11239424, 20480000, 23887872


Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 38 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.


[root@local103 dbbackup]# mkdir /disk3

[root@local103 dbbackup]# mount /dev/sdc2 /disk3


添加到/etc/fstab

LABEL=/                 /                       ext3    defaults        1 1

LABEL=/boot             /boot                   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-sda3         swap                    swap    defaults        0 0

/dev/sdb1               /disk1                  ext3    defaults        1 3

/dev/sdc1               /disk2                  ext3    defaults        1 4

/dev/sdc2               /disk3                  ext3    defaults        1 5


本文出自 “deven的博客” 博客,请务必保留此出处http://wwdhks.blog.51cto.com/839773/1616440

利用fdisk将硬盘剩余空间进行分区

标签:fdisk

原文地址:http://wwdhks.blog.51cto.com/839773/1616440

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!