Linux Add disk space

Source: Internet
Author: User
Tags hex code

First you need to turn off the system, make the allocated hard disk space larger, or re-establish a virtual hard disk (then the following is not SDA, but SDB1). Both of these methods are feasible and I have tried.
Second, log in to your Linux system with the root user and view your system's partitions
#fdisk-L
The following information will appear:
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
/dev/sda2 2611 20458496 8e Linux LVM

disk/dev/mapper/vg_zxw-lv_root:18.8 GB, 18832424960 bytes
255 heads, Sectors/track, 2289 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000

Disk/dev/mapper/vg_zxw-lv_root doesn ' t contain a valid partition table

disk/dev/mapper/vg_zxw-lv_swap:2113 MB, 2113929216 bytes
255 heads, Sectors/track, 257 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000

Disk/dev/mapper/vg_zxw-lv_swap doesn ' t contain a valid partition table
According to the prompt information can be determined that the system's disk interface is SCSI, corresponding to "SDA" if the above red font is "HDA", then the system's disk interface for the IDE "HDA" so I do the operation:

#fdisK/DEV/SDA

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').

Command (M for help): M//"list Fdisk's assistance"
Command Action
A toggle a bootable flag
b Edit BSD Disklabel
C Toggle the DOS compatibility flag
D Delete a partition
L list known partition types
M Print this menu
n Add a new partition
o Create a new empty DOS partition table
P Print the partition table
Q Quit without saving changes
s create a new empty Sun Disklabel
t change a partition ' s system ID
U Change display/entry units
V Verify the partition table
W Write table to disk and exit
X Extra functionality (experts only)

Command (M for help): N//"N to add new partition"
Command Action
E Extended
P primary partition (1-4)
P//"Select Create Primary Partition" At this point,

Partition number (1-4): 3//fdisk will let you select the primary partition's numbers, if you already have the primary partition Sda1,sda2, then the number is selected 3, that is, the partition to be created Sda3.
First cylinder (2611-3916, default 2611)://At this point, Fdisk will let you choose the starting value of the partition this is the start value of the partition (start cylinder); It is best to press ENTER directly,
Using Default Value 2611
Last cylinder, +cylinders or +size{k,m,g} (2611-3916, default 3916)://At this point, Fdisk will let you choose the start value of the partition this is the end of the partition Value it's best to press ENTER directly,
Using Default Value 3916

Command (M for help): W//w "Save All and exit, Partition complete"
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 is being used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
Syncing disks.
Third, our new partition/dev/sda3, but not LVM. So, next use Fdisk to change it to LVM.
#fdisk/DEV/SDA
Command (M for help): M
Command (M for help): t//change partition system ID

Partition number (1-4): 3//Specify partition numbers
Hex code (type L to list codes): 8e//Specifies the ID number to be changed, and 8e represents LVM.
Command (M for help): W
Third, after restarting the system, the landing system. (Be sure to restart the system, or you will not be able to expand the new partition)
D. Format the newly added partition:
#fdisk-L

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
/dev/sda2 2611 20458496 8e Linux LVM
/dev/sda3 2611 3916 10483750 8e Linux LVM
You'll find a piece of partition more.
#mkfs-T ext3/dev/sda3//Create a "ext3" file system on the hard disk partition "/dev/sda3".
Then we attach this partition to this system:

V. Using the command mount

Mount-t Ext3/dev/sda3/mnt/disk2

Here's the Disk2, is to mount the directory itself, do not know how to use the command can be viewed with the man command. Mans Mount.

Linux Add disk space

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.