How to Move Your Home Folder to Another Partition

发布于 2016/07/16 20:13
字数 915
阅读 22
收藏 0
点赞 0
评论 0

If you have accepted the default option while installing Ubuntu, or that your computer comes with Ubuntu pre-installed, chances are that your Home folder and the system folders all lie in the same partition. This is perfectly fine, but if you want to upgrade your existing Ubuntu version, or reinstall Ubuntu, you won’t be able to preserve your app settings, or even retain your files and documents. One of the good practice is to give the Home folder its own partition, so whatever changes you made to the System folder won’t affect your Home directory, and you can easily upgrade or reinstall Ubuntu with ease.


If you want to move your Home folder to another partition, here is how you can do so.

Creating a new partition

Note: You can skip this step if you already has an existing external partition that you can use.

Assuming that your computer has only one hard disk and it contains only one partition. To create a new partition, you have to first obtain a Ubuntu Live CD/USB and boot into it. You can’t partition the hard disk when it is running.

Once you are booted into the Live session, open the app “GParted”. Select the hard disk from the list. It should be labelled something like “sda”.


You should see a number of entries in the list. Select the entry that corresponds to the main partition. It should be the one with the biggest file size and is either in the ext3 or ext4 filesystem format. Right click on it and select “Resize/Move”.


Set the size for the new partition in the “Free Space Following” field. The number is represented in MB, so if you want to set aside 10GB for the new partition, enter “10000”. You will notice that as you enter the number, the number in the “New Size” field will decrease accordingly. My usual practice is to set aside 10GB for the system files and allocate the rest to the Home partition. Click “Resize/Move”.


Back to the GParted main screen, you should now see a new “Unallocated” entry with the file size that you have set earlier. Right click on it and select “New”. Select “ext4” as the filesystem and click “Add”.


Lastly. click the green check button to apply the changes. Depending on your hard disk size, the resizing process might take a long time


After the process is completed, you should see something like the screen below. Record down the new partition number.


Now shut down the live session, remove the live CD/USB and boot up the computer.

Migrating the Home folder

To migrate your current Home folder to an external partition, there are four things that you need to do:

  1. Mount the external partition onto a temporary Home location.
  2. Copy the files from your current Home folder to this temporary Home folder.
  3. Relocate the current Home folder
  4. Mount the new Home folder.

1. Create a temporary Home folder

Open a terminal and type the following:

sudo blkid

This will display the UID of all the partitions. Record down the UUID for the partition that you have created earlier.


Next, open the fstab file:

sudo nano /etc/fstab

and add the following line to the end of the file.

UUID=xxx-xxxxx-xxxxx   /media/home    ext4          nodev,nosuid       0       2

Replace the UUID with the UUID value of the external partition.


Save (Ctrl + o) and exit (ctrl + x) the file.

Next, create a mount point:

sudo mkdir /media/home

and reload the updated fstab.

sudo mount -a

You should now see a “home” folder in the Media directory.

2. Copy the files from your current Home folder to the new Home folder

The next thing we are going to do is to copy all the files from the current Home folder to the new Home folder. You can simply do a “Select all”, “Copy” and “Paste” to transfer all the files to the new Home folder. However, you might be missing out the hidden files and some of the file permissions might not be preserved. A more complete method would be using rsync.

sudo rsync -aXS /home/. /media/home/.

3. Relocate the current Home folder

Once we have set up the new Home folder, we need to remove the existing Home folder to make way for the new Home folder in the external partition. To do that, type the following commands in the terminal:

cd /
sudo mv /home /home_backup
sudo mkdir /home

What the above commands do is to move the existing Home folder to Home_backup, and create an empty Home folder for the new Home folder to mount to.

4. Mount the new Home folder

The last step to complete the migration is to mount the new Home folder as “/home”. To do that, we have to revisit the fstab file again.

sudo nano /etc/fstab

All you have to do is to change the “/media/home” to “/home”. Save and exit the file.


Lastly, reload the fstab file:

sudo mount -a

That’s it. You have now migrated your Home folder to an external partition.

Optional: removing the Home_backup folder


Once you are done with the migration, you can either use the old Home folder as a backup, or remove it to release the storage space. To remove it, use the command:

sudo rm -rf /home_backup

Let us know in the comments if you encountered any difficulty.

© 著作权归作者所有

共有 人打赏支持
粉丝 4
博文 109
码字总数 29707
作品 0
Mac OS: iMovie and iMovie HD Troubleshooting(英/中)

iMovie and iMovie HD Troubleshooting Disk Partition Format: iMovie project must be created/opened/modified on a Mac OS Extended or Mac OS Extended(Journaled) partition. If not, ......

junwong ⋅ 2012/03/09 ⋅ 0

Porteus Kiosk 4.1.0 发布,轻量级 Linux 操作系统

Porteus Kiosk 4.1.0 发布了,Porteus Kiosk 是轻量级的Linux操作系统,它基于 GentooLinux 但却被限制为只允许运行一个应用程序即 Firefox网页浏览器。该浏览器被锁定从而阻止用户去改动设置...

催呀催呀 ⋅ 2016/09/06 ⋅ 9


sudo vim /etc/fstab 添加如下内容 // /path/to/mount cifs username=adminz,password=passwordz 服务器端是windows共享目录,或者是linux用samba共享的目录 关于默认权......

lieefu ⋅ 2016/12/15 ⋅ 0


1 将排序结果插入到新文件中 hive> insert overwrite table retable1 select * from table1 cluster by id; 2 在shell中使用hive $HIVEHOME/bin/hive -S -e "select from table1 cluster by ......

闵开慧 ⋅ 2014/04/01 ⋅ 0

Ubuntu 添加新分区 并设置挂载点


长平狐 ⋅ 2012/08/28 ⋅ 1

Linux上构筑iPhone OS3.1.2开发环境之解压firmware

文章出处:http://blog.csdn.net/lmss82/article/details/5296261 #第一步没有什么问题 $ ./toolchain.sh headers #第二步也顺利通过 $ ./toolchain.sh firmware #第三步也挺顺利 $ ./toolch......

鉴客 ⋅ 2011/11/23 ⋅ 0


5、DDL语句 5.1 Enable/Disable/Validate/Novalidate 组合特性说明: 是否要求满足约束 Validate Novalidate 已有记录 新增/修改记录 已有记录 新增/修改记录 Enable Yes Yes No Yes Disabl...

yeyelei ⋅ 2012/07/15 ⋅ 0


终端提示 yy@ubuntu:/home/android$ emulator emulator: WARNING: system partition size adjusted to match image file (72 MB > 66 MB) 我设置了yy@ubuntu:/home/android$ emulator -part......

springsnds ⋅ 2012/04/05 ⋅ 2

L-1-21 远程连接命令

[lftp] lftp //登陆ftp服务器 get //获取某个文件到本地系统当前目录 bye //断开连接 [scp] scp 跨主机安全复制工具 scp localfile remoteusername@remoteip:remotefolder scp localfile rem...

tangjiashiertui ⋅ 01/04 ⋅ 0


如何限制用户的空间使用配额; 第一步: 限制用户使用配额;以home这个配额空间必须是一个独立挂载点;如果是新添加磁盘需要重新识别;重启机器或者执行: echo '- - -' > /sys/class/scsi_h...

长得丑死了 ⋅ 2017/12/19 ⋅ 0






版本:Boost 1.66.0 Windows库编译 官网指南:直接执行bootstrap.bat处理文件即可,可以我却遇到一堆的问题。 环境:Windows 10 + Visual Studio 2017 Boost编译出来库命名 boost库生成文件命...

水海云 ⋅ 4分钟前 ⋅ 0


如果jar文件是以外部依赖的形式导入的。Eclipse将web项目发布到Tomcat时,是不会自动发布这些依赖的。 可以通过Eclipse在项目上右击 - Propertics - Deployment Assembly,添加“Java Build ...

ArlenXu ⋅ 4分钟前 ⋅ 0

iview tree组件层级过多时可左右滚动

使用vue+iview的tree组件,iview官网iview的tree树形控件 问题描述:tree层级过多时左右不可滚动 问题解决:修改overflow属性值 .el-tree-node>.el-tree-node_children { overflow: vi...

YXMBetter ⋅ 6分钟前 ⋅ 0


通过数据库实现 http://www.weizijun.cn/2016/03/17/%E8%81%8A%E4%B8%80%E8%81%8A%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81%E7%9A%84%E8%AE%BE%E8%AE%A1/ ZK实现:curator-recipes分布式锁的使用......

素雷 ⋅ 14分钟前 ⋅ 0

Sublime Text3 快捷键

选择类 Ctrl+D 选中光标所占的文本,继续操作则会选中下一个相同的文本。 Alt+F3 选中文本按下快捷键,即可一次性选择全部的相同文本进行同时编辑。举个栗子:快速选中并更改所有相同的变量名...

AndyZhouX ⋅ 21分钟前 ⋅ 0


XamarinAndroid组件教程RecylerView自定义适配器动画 如果RecyclerViewAnimators.Adapters命名空间中没有所需要的适配器动画,开发者可以自定义动画。此时,需要让自定义的动画继承Animation...

大学霸 ⋅ 21分钟前 ⋅ 0

eureka 基础(二)

使用Eureka服务器进行身份验证 如果其中一个eureka.client.serviceUrl.defaultZone网址中包含一个凭据(如http://user:password@localhost:8761/eureka)),HTTP基本身份验证将自动添加到您...

明理萝 ⋅ 24分钟前 ⋅ 1

Kubernetes(五) - Service


喵了_个咪 ⋅ 24分钟前 ⋅ 0



森火 ⋅ 37分钟前 ⋅ 0


一、IDEA如何安装SonarLint插件 1.打开 Idea 2.点击【File】 3.点击【Settings】 4.点击【Plugins】 5.在搜索栏中输入“sonarlint”关键字 6.点击【Install】进行安装 7.重启Idea 二、IDEA如...

开源中国成都区源花 ⋅ 42分钟前 ⋅ 0