VMware Virtual Machine Red Hat 5.9 swap zone and hard disk space adjustment

Source: Internet
Author: User

First, we need to use VMware settings to expand the memory. But how should I set/swap in the system?

1. Create a swap file

Run the following command:

  # Dd If =/dev/Zero of =/SWAP/swapfile BS = 1 m COUNT = 3072

 

The DD command uses a block of the specified size to copy an object and convert it at the same time.

Syntax: dd [Option]

If = input file (or device name ).

Of = output file (or device name ).

IBS = Bytes: the number of bytes read from the buffer zone.

Skip = blocks skip the IBS * blocks block at the beginning of the read buffer.

Obs = Bytes: the number of bytes written to the buffer zone.

BS = Bytes: set the number of bytes in the read/write buffer at the same time (equal to setting IBS and OBS ).

Count = blocks only copies the input blocks block.

 

2. format the swap partition File

Run the following command:

# Mkswap/SWAP/swapfile

 

3. Enable swap partition File

Run the following command:

  # Swapon/SWAP/swapfile

 

Mkswap [parameter] device name [number of blocks]

Create a Linux swap zone (SWAP) on the settings or files)

Syntax:

Device name. The device here is usually a disk partition, such as/dev/sda6, or a file/swapfile

-C check whether there are bad channels before creating a swap space. If there are bad channels, the total number of bad channels is displayed.

-F: run the mkswap command forcibly.

-P <page size> specifies the page size used.

-L <tag> specifies a tag, which can be used by Swapon.

-V0: creates an old-style swap zone.

-V1 creates a new exchange zone. The parameter can be omitted. The preceding command is used only in this way.

 

4. View related statuses

Run the following command:

# Swapon-S

 

5. Add the following content to/etc/fstab so that/SWAP/swapfile is used as swap every time the system starts.

/SWAP/swapfile swap default 0 0

 

Next, let's talk about the hard drive adjustment.

For this purpose, we can use the command line tool provided by VMware,Vmware-vdiskmanager.exe.

The tool is located in the installation directory of VMware.

Run the following command:

Vmware-vdiskmanager-x 60 GB "D: \ VMware \ Red Hat Enterprise Linux 5 64-bit. vmdk. vmdk"

-X is followed by the disk space to be expanded. The quotation marks indicate the disk location corresponding to the virtual system.

When you open the VM, you can see that the disk space has expanded. However, the following operations are required to make the expanded space available to the system.

 

1. Print the current Disk Partition TableFdisk-l:

At this time, we can see that the total number of disks has indeed increased to 60 GB, but the partitions have not changed.

Type the following command:Fdisk/dev/SDA

Type:M"List fdisk help"

Here we want to add a new partition, which will be scaled out into a new partition, so that it can be identified by the operating system mounting.

Type:N"Command N is used to add a new partition"

At this time, fdisk will let you choose to add as a logical partition (number starting from 5) or primary partition (Number 1 to 4 ). Select the primary partition, and then type P. Select logical partition and enter L.

We select the primary partition as follows:

Type:P"Select create primary partition"

At this time, fdisk will let you select the number of the primary partition. If you already have the sda1 and sda2 primary partitions, select 3 as the number, that is, the partition to be created is sda3.

Type:3

At this time, fdisk will let you choose the start value of the partition. This is the start cylinder value of the partition. You 'd better press enter here,

If you enter a non-default number, the space is wasted;

Enter:W"Save all and exit. Partition finished"

 

4. format the newly added partition:

Type:Mkfs-T ext3/dev/sda3

 

5. Mount the partition:

A. Manually mount the disk, type:

    Mount/dev/sda3/home/work/

"Mount the new partition to the/home/work/directory"

 

B. If the mounting is automatically started, modify the/etc/fstab file and add a line in the file:

    /Dev/sda3/home/work ext3 defaults, 0 1

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.