Centos 6 use Command Line mount new disk
Complete operation Command for Centos 6, using Command Line to amount the new disk space
{ Disk Overview }
>> df -h
[root@MyServer YiiLib.com@666]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_have-lv_root
8.5G 6.7G 1.4G 84% /
tmpfs 935M 0 935M 0% /dev/shm
/dev/xvda1 485M 71M 389M 16% /boot
/dev/mapper/Xvdbgroup-xvdb1
4.9G 1.8G 2.9G 39% /home
{ Disk Detail }
>> fdisk -l
... ...
Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006cde7
Device Boot Start End Blocks Id System
/dev/xvdb1 1 652 5237158+ 83 Linux
... ...
Useful info here:
21.5GB + 2610 cylinders
used 1 - 652 (653-2610 free, here is cylinders)
{ Arrange New Space }
>> fdisk /dev/xvdb
>p
Command (m for help): p
Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006cde7
Device Boot Start End Blocks Id System
/dev/xvdb1 1 652 5237158+ 83 Linux
>n
Command (m for help): n
>p
Command action
e extended
p primary partition (1-4)
>2
Partition number (1-4): 2
>653
First cylinder (653-2610, default 653):
Using default value 653
>2610
Last cylinder, +cylinders or +size{K,M,G} (653-2610, default 2610):
Using default value 2610
>p
Command (m for help): p
Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006cde7
Device Boot Start End Blocks Id System
/dev/xvdb1 1 652 5237158+ 83 Linux
/dev/xvdb2 653 2610 15727635 83 Linux
>w
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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
use the above command set 653-2610 cylinders to /dev/xvdb2, be careful with partition type(extended and primary partition) for primary partition can only have 4, rest should be extended
{ Effective New Partition }
Reboot or using fdisk command, suggest reboot here.
{ Format New Partition }
>> mkfs -t ext4 /dev/xvdb2
[root@MyServer YiiLib.com@666]# mkfs -t ext4 /dev/xvdb2
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
983040 inodes, 3931908 blocks
196595 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4026531840
120 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
suggest keep ext4 as format type
{ Amount New Partition }
>> mkdir /eebox
>> mount -t ext4 /dev/xvdb2 /eebox
>> df -h
[root@MyServer YiiLib.com@666]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_have-lv_root
8.5G 6.7G 1.4G 84% /
tmpfs 935M 0 935M 0% /dev/shm
/dev/xvda1 485M 71M 389M 16% /boot
/dev/mapper/Xvdbgroup-xvdb1
4.9G 1.8G 2.9G 39% /home
/dev/xvdb2 15G 166M 14G 2% /eebox
{ NOT FINISH YET!! }
If u reboot right now, you will find the new partition is missing, so let's edit /etc/fstab and add one line
>> cat /etc/fstab
>> add the follow line
/dev/xvdb2 /eebox ext4 defaults 0 0
>> save
Leave Comment