How to extend hard disk under virtual machine Linux __linux

Source: Internet
Author: User
Tags extend

"Original link": http://blog.csdn.net/tianlesoftware/article/details/5642883

Install the virtual machine space is small, then added 5G space, toss a half-day, hang up. Tidy up a note, spare.

1. Add disk to view disk status

[ROOT@DB1/]# Fdisk-l

disk/dev/sda:10.7 GB, 10737418240 bytes

255 heads, Sectors/track, 1305 cylinders

Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 * 151 1305 9277537+ Linux

/dev/sda2 1 1204843+ Linux swap

Partition table entries are in-disk order

disk/dev/sdb:5368 MB, 5368709120 bytes

255 heads, Sectors/track, 652 cylinders

Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System

From the results of the query, a/DEV/SDB disk

2. use Fdisk to partition the/dev/sdb

[ROOT@DB1/]# Fdisk/dev/sdb

Command (M for help): N

Command Action

E Extended

P primary partition (1-4)

P

Partition number (1-4): 1

The cylinder (1-652, default 1):

Using Default value 1

Last cylinder or +size or +sizem or +sizek (1-652, default 652):

Using Default value 652

Command (M for help): W

The partition table has been altered!

Calling IOCTL () to re-read partition table.

Syncing disks.

Look at the partition again, come out with a/dev/sdb1 area, this 1 is what we specified earlier, if we specify 2, it becomes sdb2.

[ROOT@DB1/]# Fdisk-l

disk/dev/sda:10.7 GB, 10737418240 bytes

255 heads, Sectors/track, 1305 cylinders

Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 * 151 1305 9277537+ Linux

/dev/sda2 1 1204843+ Linux swap

Partition table entries are in-disk order

disk/dev/sdb:5368 MB, 5368709120 bytes

255 heads, Sectors/track, 652 cylinders

Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System

/DEV/SDB1 1 652 5237158+ Linux

[ROOT@DB1/]#

If the/proc/partitions does not see the corresponding partition after it is created, use the Parprobe command to refresh it:

[Root@web1 ~]# Cat/proc/partitions
Major Minor #blocks name


8 0 175825944 SDA
8 1 1020096 sda1
8 2 30716280 Sda2
8 3 8193150 Sda3
[Root@web1 ~]# PARTPROBE/DEV/SDA
[Root@web1 ~]# Cat/proc/partitions
Major Minor #blocks name


8 0 175825944 SDA
8 1 1020096 sda1
8 2 30716280 Sda2
8 3 8193150 Sda3
8 4 135893835 SDA4
[Root@web1 ~]#



3. format/DEV/SDB1 partition

[ROOT@DB1/]# mkfs-t EXT3/DEV/SDB1

MKE2FS 1.35 (28-feb-2004)

FileSystem label=

OS Type:linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

655360 inodes, 1309289 blocks

65464 blocks (5.00%) reserved for the Super user

The Data block=0

Maximum filesystem blocks=1342177280

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

Writing Inode Tables:done

Creating journal (8192 blocks): Done

Writing superblocks and filesystem accounting Information:done

This filesystem'll be automatically checked every mounts or

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

4. Create the table of contents and hang the/DEV/SDB1 to the directory

[ROOT@DB1/]# ls

Backup dev initrd media opt sbin sys usr

Bin etc Lib Misc proc SELinux tftpboot var

Boot home lost+found mnt root SRV tmp

[ROOT@DB1/]# mkdir/u01

[ROOT@DB1/]# ls

Backup dev initrd media opt sbin sys u01

Bin etc Lib misc proc SELinux tftpboot usr

Boot home lost+found mnt root SRV tmp var

[ROOT@DB1/]# mount/dev/sdb1/u01

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.