Linux: mount the disk into /home

Table of Contents

1. Step 1: find the filename of disk with sudo fdisk -l, like /dev/sda

2. Step2: mount the disk to a temporal directory.

  1. mkdir /media/home
  2. mount /dev/sda /media/home

3. Step3: Copy the data in home and backup.

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

mv /home /home_old

4. Step 4: new /home and mount it.

mkdir /home
umount /dev/sda
mount /dev/sda /home

5. Step 5: automatically mount for future usage.

sudo vim /etc/fstab

add

/dev/sda /home ext4 defaults 0 2

or

UUID=8da46012-ab9c-434f-a855-2484112fd1a7 /home ext4 nodev,nosuid 0 2


Author: Zi Liang (zi1415926.liang@connect.polyu.hk) Create Date: Tue Nov 5 14:40:40 2024 Last modified: 2024-11-09 Sat 15:00 Creator: Emacs 29.2 (Org mode 9.6.28)