Use LiveUSB for Ubuntu partitioning

Source: Internet
Author: User
Article Title: Use LiveUSB for Ubuntu partitioning. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Ubuntu 10.04 has already met with you, and many users have joined Ubuntu fans. When you use it, you will find out how amazing open-source technology is. Before getting to know more about the Ubuntu partition, let's first take a look at the Ubuntu partition, hoping to help you.

Since I used Ubuntu, I found that the dependency on Windows is getting smaller and smaller. I deleted my Vista two days ago, and now the system only has Ubuntu, so I want to switch Ubuntu from partition 3 during installation to partition 1. The results of the experiment are as follows: I only discuss technical issues. I shall not be liable for any data losses or other problems arising therefrom.

My configuration: partition:

◆ Sda1 original Vista.

◆ The sda2 extension partition has two logical partitions (sda5 and sda6 ).

◆ Sda3 Ubuntu partition.

◆ Sda4 Swap partition.

Start from LiveUSB (LiveCD.

Use the LiveUSB tool of the existing system and install the image to create LiveUSB. Of course, you can also use LiveCD. We recommend that you use LiveUSB (LiveCD may not be able to create a directory when mounting the partition ); select your boot device in the boot options (use the Del key, F2 key, or F12 key to enter the boot options, depending on the machine)

Mount sda1 and sda3.

You can mount the file in the file browser or manually use the mount command.

Move a file.

Use cp-ax/media/to partition 3/*/media/to partition 1/"partition 1" is the directory mounted by sda1, and "partition 3" is the directory mounted by sda3, adding the-ax parameter ensures that attributes are retained during replication.

Reinstall grub.

The purpose of this step is to ensure that grub looks for the menu. lst file from sda1, rather than the original sda3. Method: Still on LiveUSB, open the terminal, enter the sudo grub command, may wait for a while, then the grub> prompt appears; enter find/boot/grub/stage1, if (hd0, 0) (hd0, 2), it means that you have no problems copying; then input: root (hd0, 0 ), it indicates that the boot partition is The 0th partition on 0th hard disks (0 indicates 1, 1 indicates 2 in grub, and so on). Then, enter setup (hd0) to mount grub to 0th hard disks.

Modify menu. lst.

◆ The key to this step is the ability to start a new system. Open the terminal;

◆ Convert the original menu. lst rename: Enter the/boot/grub directory under partition 3 in the terminal and use sudo mv menu. lst newfilename. change the name of lst (newfilename is any other name). Run the cd command to enter the/boot/grub directory under the sda1 Mount directory;

◆ View the partition UUID: sudo ls-l/dev/disk/by-uuid, and record the UUID of sda1 and sda3 (Partition Number sdx at the end of the row );

◆ Modify the menu on partition 1. lst: sudo cp menu. lst menu. lst. backupfile (Backup menu. lst file) sudo gedit menu. lst, replace the UUID of sda3 with the UUID of sda1, save it, and close gedit and terminal;

Note: Some grub may not use UUID to identify partitions. You can change/dev/sda3 in menu. lst to/dev/sda1.

Restart. Start from hard disk (change back to your settings and stop using LiveUSB)

If it succeeds, go to any directory to check the remaining space. If it is consistent with the remaining space of the new partition, this step will start with the new partition. If there is no problem after you use it for a while, you can delete the original sda3 for other purposes. If it fails, restore menu. lst on partition 3, and use root (hd0, 2) under the grub command, and then setup (hd0) to reinstall grub. If you have any questions about Ubuntu partitioning, you are welcome to discuss it actively.

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.