Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of Ubuntu Linux Mobile Root Partition

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "Ubuntu Linux Mobile Root Partition case Analysis". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "Ubuntu Linux Mobile Root Partition instance Analysis".

The experimental results are as follows:

0: my configuration: partition: sda1 original Vista, sda2 extended partition, there are two logical partitions (sda5,sda6), sda3 Ubuntu Linux partition, sda4 Swap partition

1: start from LiveUSB (LiveCD).

Use the existing system's production LiveUSB tool and installation image to make LiveUSB. Of course, you can also use LiveCD. It is recommended to use LiveUSB (LiveCD may not be able to create a directory when the partition is mounted)

Select your boot device in the boot options (use Del key or F2 key or F12 key to enter the boot option, depending on the machine)

2: Mount sda1 and sda3.

There is nothing to say about this. You can mount it in a file browser or use the mount command manually.

3: move the file.

Use the cp-ax / media/ partition 3Accord * / media/ 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 the attributes are retained during replication.

4: reinstall grub.

The goal of this step is to ensure that grub looks for the menu.lst file from sda1, not the original sda3. Method: still on the LiveUSB, open the terminal, enter the sudo grub command, it may take a while, and then the grub > prompt appears; enter find / boot/grub/stage1, if there are two items (hd0,0) (hd0,2), it means you have no problem with the copy; then enter: root (hd0,0), indicating that the boot partition is the 0th partition on the 0th hard disk (in grub, 0 means 1 for 2, and so on) Then type: setup (hd0) to install grub on the 0th hard drive.

5: modify menu.lst.

This is the most critical step, which is the key to whether it can be started from the new system.

◆, open the terminal

◆ renamed the original menu.lst: enter the / boot/grub directory in the partition 3 directory in the terminal, and use sudo mv menu.lst newfilename to rename the menu.lst (newfilename to any other name cd command to enter the / boot/grub directory under the sda1 mount directory

◆ looks at the partition UUID:sudo ls-l / dev/disk/by-uuid and records the UUID of sda1 and sda3 (partition number sdx at the end of the line)

Modify the menu.lst on partition 1:

◆ sudo cp menu.lst menu.lst.backupfile (backup menu.lst files)

◆ sudo gedit menu.lst, replace all UUID of sda3 with UUID of sda1, then save and close gedit and terminal

Note: some people's grub may not use UUID to identify the partition, you can directly change the / dev/sda3 in the menu.lst to / dev/sda1.

6: restart. Boot from the hard drive (change back to your settings and no longer boot with LiveUSB)

If successful, enter any directory to check the remaining space. If it matches the remaining space of the new partition, this step will enter the new partition. If you have no problem after using it for a period of time, you can delete the original sda3 for other use.

If it fails, restore the menu.lst on partition 3 and use root (hd0,2) and then setup (hd0) under the grub command to reinstall grub.

At this point, I believe you have a deeper understanding of the "Ubuntu Linux Mobile Root Partition instance Analysis". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report