Resize redhat5.5 partitions under VMWare Virtual Machine

Source: Internet
Author: User
Tags hex code

To the Virtual Machine VMWare redhat5.5 root partition resizing today in Linux Through sqlplus/as sysdba to start the database to report the following ERROR: ORA-09817: Write to audit file failed. linux-x86_64 Error: 28: No space left on device ORA-09945: Unable to initialize the audit trail file Linux-x86_64 Error: 28: no space left on device check found that the root partition of the Linux virtual machine is already using 100%, so that the service cannot proceed normally: [oracle @ etl110 ~] $ Df-h file system capacity used available % mount point/dev/mapper/VolGroup00-lvm_root 16G 15G 0 100%/dev/mapper/VolGroup00-lv_home 2.0G 68 M 1.8G 4%/ home/dev/sda1 99 M 13 M 82 M 14%/boot tmpfs 579 M 0 579 M 0%/dev/shm consider expanding the Virtual Machine disk space from 20 GB to 40 GB, LVM-based operations: Step 1: Use the VMware tool to resize the allocated hard disk space. vmware provides a command line tool. In Windows, vmware-vdiskmanager.exe is located in the vmware installation directory, for example, vmware-vdiskmanager.exe. in Linux, there is a direct vmware-vdiskmanager command. The operation is performed in the window. In s, enter the command line window, go to the vmware installation directory, and execute vmware-vdiskmanager.exe. in Linux, directly press vmware-vdiskmanager to execute the command to expand the usage: vmware-vdiskmanager-x 40 Gb vmdisk1.vmdk. Note: The system to be resized cannot be running at this time. The parameter "-x" indicates that the disk space of the virtual machine needs to be extended, followed by the number to be extended, instead of increasing the disk capacity (in this example, it is expanded to 40 GB, which is the total disk capacity, including the original disk capacity ). Finally, it is the specific file of the Virtual Machine disk to be operated. If there is a space in the path name, it must be enclosed in double quotation marks. Press the Enter key to start execution. After the execution is complete, exit the Command Prompt window and restart VMware. The hard disk space of the virtual machine has changed to 40 GB. 2. After restarting the virtual machine, we found that the hard disk of the virtual machine was changed to 40 GB, but after entering the linux system, we used "df-h" to check whether the hard disk space was as large as originally. Although the disk has been expanded, the linux operating system cannot be identified because the file system has not been partitioned. In fact, it is equivalent to the fact that although your hard disk is large, you have not partitioned it. Step 2: Use the fdisk tool in Linux for partitioning. First, you need to log on to the system as root. Run the fdisk-l command to print the current Disk Partition Table: [root @ etl110 ~] # Fdisk-l Disk/dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 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 2610 20860402 + 8e Linux LVM (1) run the following command: fdisk/dev/sda. sda is the resized hard disk, which is a SCSI hard disk, and an IDE-type Hard Disk corresponds to hda, which is used to operate the hard disk. (2) Type: m press enter to list fdisk help; (3) type: n press enter to add a new partition, fdisk will let you choose to add as a logical partition (number from 5) or the primary partition (numbers 1 to 4), type p to select the primary partition, and type l to select the logical partition. Here, we type p to select the primary partition, after you press enter, fdisk will ask you to select the number of the primary partition. If you already have sda1 and sda2, select 3 as the number, that is, the partition to be created is sda3, next, fdisk will let you select the Start value of the partition as the Start value and End value of the partition. Press enter to select the default value. Finally, enter w to write data to the partition table. The entire operation is as follows, I added the note with the # sign to facilitate your understanding. [Root @ etl110 ~] # Fdisk/dev/sda The number of cylinders for this disk is set to 5221. there is nothing wrong with that, but this is larger than 1024, and cocould 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): m # Get Command help LIST Command action a toggle a bootable fl Ag 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 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 # create a partition Command action e extended p primary Partition (1-4) p partition number (1-4 ): 3 # create the First cylinder (2611-5221, default 2611) partition with ID 3: # Press enter, use the default Using default value 2611 Last cylinder or + size or + sizeM or + sizeK (2611-5221, default 5221): # Press enter directly, use the default Using default value 5221 Command (m for help): t # modify the system Partition ID number Partition num Ber (1-4): 3 # specify the ID number of the partition to be modified Hex code (type L to list codes): 8e # specify the ID number to be changed, 8e stands for LVM Changed system type of partition 3 to 8e (Linux LVM) Command (m for help): w # Write The partition table has been altered! Calling ioctl () to re-read partition table. WARNING: Re-reading the partition table failed with error 16: the device or resource is busy. the kernel still uses the old table. the new table will be used at the next reboot. [root @ etl110 ~] # After reboot restarts the system, you can see sda3 under/dev/. Step 3: format the newly added partition and enter the command mkfs-t ext3/dev/sda3, format/dev/sda3 to ext3. The procedure is as follows: [root @ etl110 ~] # Mkfs-t ext3/dev/sda3 mke2fs 1.39 (29-May-2006) warning: 334 blocks unused. filesystem label = OS type: Linux Block size = 4096 (log = 2) Fragment size = 4096 (log = 2) 2626560 inodes, 5242880 blocks 262160 blocks (5.00%) reserved for the super user First data block = 0 Maximum filesystem blocks = 4294967296 160 block groups 32768 blocks per group, 32768 fragments per group 16416 inodes per group Superblock Backups stored on blocks: 32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,409 6000 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 29 mounts or 180 days, whichever comes first. use tune2fs-c or-I to override. so far, we have created a new partition/dev/sda3. Now we can Use the new space through mounting. However, because the database is installed in the root directory, the root directory space has been used up, so you can use the new partition in a more directory, the root directory space can be shared to solve the problem. Step 4: Expand the root partition based on LVM [root @ etl110 ~] # Lvs/dev/hdc: open failed: unable to find the medium lv vg Attr LSize Origin Snap % Move Log Copy % Convert lv_home VolGroup00-wi-ao 2.00G lvm_root VolGroup00-wi-ao 15.59G lvm_swap VolGroup00-wi-ao 2.28G [root @ etl110 ~] # Pvcreate/dev/sda3 Physical volume "/dev/sda3" successfully created [root @ etl110 ~] # Vgextend VolGroup00/dev/sda3/dev/hdc: open failed: Media Volume group "VolGroup00" successfully extended [root @ etl110 ~] # Vgdisplay/dev/hdc: open failed: media --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable max lv 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 2 Act PV 2 VG Size 39.88 gb pe Size 32.00 MB Total PE 1276 Alloc PE/Size 636/19 .88 GB Free PE/Size 640/20 .00 gb vg uuid J7KBM7-dcwF-3SXr-WLlL-IJIg-LuNy-3rp0jg main view Fr Ee PE/Size 640/20 .00 GB, which means we can have up to 20 GB of extended space. Finally, run the following command to add space to the root partition: [root @ etl110 ~] # Df-h file system capacity used available % mount point/dev/mapper/VolGroup00-lvm_root 16G 15G 0 100%/dev/mapper/VolGroup00-lv_home 2.0G 68 M 1.8G 4%/ home/dev/sda1 99 M 13 M 82 M 14%/boot tmpfs 579 M 0 579 M 0%/dev/shm [root @ etl110 ~] # Lvextend-L + 20G/dev/mapper/VolGroup00-lvm_root/dev/sda3/dev/hdc: open failed: unable to find the media Extending logical volume lvm_root to 35.59 GB Logical volume lvm_root successfully resized [root @ etl110 ~] # Cat/etc/fstab/dev/VolGroup00/lvm_root/ext3 defaults 1 1/dev/VolGroup00/lv_home/home ext3 defaults 1 2 LABEL =/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 defaults 0 0 0/dev/VolGroup00/lvm_swap swap defaults 0 0 check the file system: e2fsck-f/dev/mapper/VolGroup00-lvm_root then, tell the system that the split area size has been adjusted: resize 2fs/dev/mapper/VolGroup00-lvm_root [root @ etl110 ~] # E2fsck-f/dev/mapper/VolGroup00-lvm_root e2fsck 1.39 (29-May-2006)/dev/mapper/VolGroup00-lvm_root is mounted. WARNING !!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n )? Yes/dev/mapper/VolGroup00-lvm_root: recovering journal Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: checking reference counts Pass 5: Checking group summary information/dev/mapper/VolGroup00-lvm_root: *** file system was modified *****/dev/mapper/VolGroup00-lvm_root: * ***** reboot linux *****/dev/mapper/VolGrou P00-lvm_root: 225531/4088000 files (1.6% non-contiguous), 3897107/4087808 blocks [root @ etl110 ~] # Resize2fs/dev/mapper/VolGroup00-lvm_root resize2fs 1.39 (29-May-2006) Filesystem at/dev/mapper/VolGroup00-lvm_root is mounted on /; on-line resizing required specify Ming an on-line resize of/dev/mapper/VolGroup00-lvm_root to 9330688 (4 k) blocks. the filesystem on/dev/mapper/VolGroup00-lvm_root is now 9330688 blocks long. after all the operations are completed, use df-h to view the expanded space: [root @ etl110 ~] # Df-h file system capacity used available % mount point/dev/mapper/VolGroup00-lvm_root 35G 15G 19G 44%/dev/mapper/VolGroup00-lv_home 2.0G 68 M 1.8G 4% /home/dev/sda1 99 M 13 M 82 M 14%/boot tmpfs 579 M 0 579 M 0%/dev/shm

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.