Space under the Linux extensions root directory

Source: Internet
Author: User
Tags hex code

I created a new user through root, but when I use this new user, I find that the space in/home/my is only dozens of M, which is completely unable to satisfy my use, so the following method expands the space under the root.

My this operation, refer to Http://www.jb51.net/LINUXjishu/84599.html

1. Switch root user

2, #fdisk-l//through this command, see I have only dozens of M space

3. #fdisk/dev/sda///start adding new partitions

  

4. List command lists

  

5, add partition (can see the command n means add a new partition)

  

Enter N, prompt to enter p, used to create the partition number, the new Linux virtual machine will generally have two SDA is sda1 and sda2, so here should enter p, enter 3, indicating the allocation of new zone Sda3. Enter 3 to enter, find prompt:

First cylinder (N-M, default N)://Use default here, so it's OK to enter directly. You will see the following prompt after carriage return:

Using Default Value N

Last cylinder, +cylinders or +size{k,m,g} (n-m, default M)://Use default here, so press ENTER and you'll see the message

Using Default Value M

Command (M for help): W//w Save All and exit, after saving there will be the following information

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 warning here is fine.
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.

6, the default allocation of Linux logical Volume Group management is not LVM and the ID change to 8e (8e for LVM, even if you do not change it does not matter, specific detailed reasons to check the document), so you need to change the newly allocated sda3 to the same sda2 LVM

    

Our new partition is/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

#reboot//Restart the system for operational applications

7, Fdisk-l view partition, will find out more sda3, and also become the LVM we want

    

  

8, expand the new partition
The #pvcreate/dev/sda3//pvcreate directive is used to initialize a physical hard disk partition to a physical volume for use by LVM. To create a physical volume, you must first partition the hard disk and set the type of the hard disk partition to "8e" before you can use the Pvcreat directive to initialize the partition to a physical volume.
Physical volume "/dev/sda3" successfully created
#vgextend Volgroup00/dev/sda3//(which is the LVM group name that needs to be expanded now, can be viewed through df-h, for example my is:/dev/mapper/volgroup00-logvol00) The vgextend directive is used for dynamic extended volume groups, which increase the capacity of a volume group by adding physical volumes to the volume group.
#vgdisplay//To display metadata information for the LNM volume group.

---Volume Group---
VG Name Vg_zxw
System ID
Format lvm2
......
Alloc pe/size 4994/27.88 GB
Free Pe/size 4994/21.88GB
VG UUID Sqbgts-ia8x-tcxz-kyxk-syws-tfxq-ubslar
(Main view free pe/size 4994/21.88GB, we can have up to 21.88GB of expansion space.) I used 20GB)


# Lvextend-l+20g/dev/volgroup00/logvol00/dev/sda3

Logical Volume LogVol00 successfully resized


#e2fsck-a/dev/volgroup00/logvol00//use e2fsck instruction to check for file system errors. You can also use the Fsck-t ext2-v/dev/sda3/to check the ext2 file system. (Do fsck, check the file system)
#resize2fs/dev/volgroup00/logvol00//resize2fs instruction is used to increase or shrink the size of the "EXT2/EXT3" file system that is not loaded.

#df-H//Check your system disk space "/" Directory becomes 27GB

      

Space under the Linux extensions root directory

Related Article

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.