Ubuntu lossless partition adjustment

Source: Internet
Author: User
Tags gparted
This is the cause of the Ubuntu lossless partition adjustment problem. you have an Ubuntu home server. The hard disk is 1 TB. I did not think much about installing the system. It is directly installed by default. That is to say, the entire 1 TB hard disk is mounted. If you do not have your own data partition, this is the cause of the lossless partition adjustment problem in Ubuntu when you redo the system. you have an Ubuntu home server. The hard disk is 1 TB. I did not think much about installing the system. It is directly installed by default. That is to say, the entire 1 TB hard disk is mounted. If you do not have your own data partitions, it will be painful to back up data when you redo the system... Therefore, we plan to partition the system, but after all, the system has been running for a while, and we are reluctant to reinstall it. Therefore, you need to adjust the partition table lossless. At this time, gparted is used. My purpose is as follows: Before Adjustment: sda1 9xxG ext4/sda5 1G swap after adjustment: sda1 150G ext4/sda2 8xxG ext4/home sda3 4G swap if you use gparted directly in the system, it will be unable to resize because the partition where the system is located has been mounted. in this case, livecd is ready. Start the system through livecd. I am using a ubuntu-12.04.1-dvd-i386.iso. Enter gparted in the command line to start the partition tool. Using Gparted for partitioning is actually quite simple. Graphical interface. I will not introduce the operation step by step. Perform the following operations to re-edit the size of an existing partition. You only need to reduce the number of existing partitions and free up the space that can be allocated. new partitions: delete partitions. delete partitions. adjust partitions as needed. You cannot mount the file when the system starts. you need to change the fstab value here. In this case, ubuntu does not seem to have tools such as arch genfstab to automatically generate fstab. you really need to despise it... It seems difficult to edit fstab. For details about the fstab file, refer to the connection ): https://help.ubuntu.com/community/Fstab . In fact, the actual operation is quite simple. The following describes the procedure: 1. because the livecd is used, it is easier to directly use the root operation to mount the new partition, therefore, use the root account to mount/dev/sda1/mnt/# The First Partition to/mnt 2. to view the UUID of a partition, you need to record the UUID ls-l/dev/disk/by-uuid # of each partition to view the partition information, including the content displayed by the uuid is similar to the following: 3. back up the original fstab, and then edit the new cd/mnt/etc # enter the directory cp fstab fstab.01 # back up fstab vim fstab # Edit the fstab content as follows: UUID is the UUID of the partition. a space is followed by a mount point, followed by a file system type, which is not described later. See the reference connection just given. Make changes based on your own partition information. In fact, the above is what I have modified. In this way, the fstab editing is completed, and the automatic mount problem after the system starts after the partition adjustment is solved. After this problem is fixed, someone will ask, your home directory already exists, is it necessary to solve the mobile problem of this home directory. That's right. now we have to solve the mobile problem of this home. Of course, it does not have much to do with the title of lossless partition. After all, some people only make adjustments and do not change the load point. 1. modify the name of the home directory to free up the mount point for the partition. (At this time,/dev/sda1 has been mounted to/mnt) mv/mnt/home/mnt/home_bak # Rename home to home_bak 2. mount the newly adjusted partition to the/mnt/home directory mkdir/mnt/home # Create/home for the partition to mount/dev/sda2/mnt/home # mount sda2 mount the partition to the/mnt/home directory. copy the folder in the original home directory to the new partition. Currently, I only have one user directory, bruce cp-a/mnt/home_bak/bruce/mnt/home. note: here, the parameter-a is used to copy the file permission. If you use ls to view the directory, the user becomes root. You can change it back as follows. This step is required. Otherwise, you cannot log on to X chroot/mnt # change root to the/mnt directory chown-R bruce: bruce/home/bruce # Change the user in the/home/bruce directory to bruce. now, the partition is adjusted lossless and you can log on to the system. There are many contents, most of which are the system parameter adjustment content after the partition is adjusted.
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.