Modify partitions (including swap) in linux)

Source: Internet
Author: User
Tags hex code
Modify the partition (including swap) in linux-Linux general technology-Linux technology and application information. For more information, see the following. I am going to install suse today, and the memory is added to 256 MB. My original partition is as follows:
Hda1: around 25 GB with rhel as 3.0 installed
Hda2: ext3 partition, which is used to hold the experiment version about 13 Gb, store the rhel CD image, and mount it to the/free directory.
Hda3: swap partition, 260 M
What I want is to get the swap partition about m, and the rest is used to install the legendary suse
First, I found a four GB small hard disk and backed up the things on hda2.
There is no disk druid available, and fdisk is used for the scalp. (believe me, it's not as difficult as it is! )
Then, log on to the text mode as the root user to view/dev/hda information.
Fdisk/dev/hda1
Type P to view partition information
Identify which partition is not what you want. Don't blame me if something goes wrong.
Enter d to delete the partition.
[Root @ x root] # fdisk/dev/hda

The number of cylinders for this disk is set to 77545.
There is nothing wrong with that, but this is larger than 1024,
And coshould in certain setups cause problems:
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): p

Disk/dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008*512 = 516096 bytes

Device Boot Start End Blocks Id System
/Dev/hda1*1 50794 25600144 + 83 Linux
/Dev/hda2 50795 77545 13482504 5 Extended
/Dev/hda5 50795 76465 12938152 + 83 Linux
/Dev/hda6 76466 77545 544288 + 82 Linux swap

Command (m for help): d
Partition number (1-6 ):
Enter the partition number you want to delete.
After the deletion is complete, type P to see if the information you want to delete is deleted.
Next, create an extended partition.
Run the fdisk command to enter n.
Then follow the prompts and try again.
Select the partition size. By default, all space is used for the extended space.
Next, create a logical partition.
Or enter n
Command (m for help): n
Command action
L logical (5 or over)
P primary partition (1-4)
Because the extended partition already exists, you can create a logical partition in it.
Select the size. I chose 50795-76465 as the place where I installed SUSE. The size is about 12 GB.
Finally, create a swap partition. I only create one for sharing RH and SUSE.
The method is the same as the method used to create a logical partition. This is a little bigger, and the rest is all given to it, totaling around 530M.
Enter t to change the file system type of the SWAp Partition
Command (m for help): t
Partition number (1-6 ):
Here I have specified partition 6.
Then specify the file system type number
Hex code (type L to list codes): 82
82 is the number of LINUX SWAP
Run the p command to view the result again. After confirming that the result is correct, run the w command to write the result to the disk. Before you enter W and press enter, nothing will be written to your hard disk, so you can give it a try, big deal ctrl + c
After I changed the fstab, I restarted and found that swap cannot be mounted.
It reminds me that swap needs to be formatted during installation.
Run mkswap/dev/hda6 to format the swap partition.
Restart again. The problem is gone.
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.