markdown 如何更改主分区

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 如何更改主分区相关的知识,希望对你有一定的参考价值。

# How to change home partition

1. Create a New Partition

2. Copy Home Files to New Partition

```
$ sudo cp -Rp /home/* /mount/location
```

   NOTE: You’ll see an error about a .gvfs directory – this is normal; you can ignore it.

   You should check the new home directory to verify it contains your files.

3. Locate the New Partition’s UUID

   The long, random-looking string above is actually the partition’s UUID, and we’ll need it to add the partition to our fstab file, which tells Linux where to mount partitions when it boots. You can also locate the partition’s UUID by running the following command in a terminal:

```
$ sudo blkid
```

4. Modify the fstab File

```
$ sudo cp /etc/fstab /etc/fstab.backup
$ sudo vim /etc/fstab
```

   Add the following text to the fstab file on a new line, replacing the _____ portion with the full UUID of your new home partition from the sudo blkid command above:

```
 UUID=_____     /home     ext4     nodev,nosuid     0     2
```
   Save the file after adding the line.

5. Move Home Directory & Restart

```
$ cd / && sudo mv /home /home_old && sudo mkdir /home
$ sudo shutdown -r now
```

6. Clean Up

   After restarting your computer, you should be able to log in normally. Ubuntu is now using the separate home partition. After making sure that everything went okay and you still have all your files in your /home directory – just in case – you can you can remove your /home_old directory to free up space:

```
$ sudo rm -rf /home_old
```

以上是关于markdown 如何更改主分区的主要内容,如果未能解决你的问题,请参考以下文章