Ubuntu add a new hard drive and replace the home partition
1. Connect the hard drive to the chassis, power on to see if the existing drive information
As you can see, there are two drives, SDA and SDB, respectively.
2. Execute fdisk-l to make sure that we are adding SDB
As can be seen, SDB this hard disk does not have the partition information, the size also conforms, the explanation is we to add the hard disk
3.
Hard disk partition:
Since the Fdisk partition can be up to 2T, it is partitioned using parted.
Execute Command parted/dev/sdb
You can access Help by typing it.
4.
Because MBR partitioned tables do not support partitions larger than 2.2TB (2.2x1012 bytes), there are some BIOS systems that replace MBR partitioned tables with GPT partitioned tables in order to support large-capacity hard disks.
So here's the GPT partition table.
5. Perform fdisk–l view hard drive details
6.
As you can see, SDB1, that is, the partition is just divided, the following SDB1 partition operation
Build Ext4 File System (customizable)
7.
Set up a temporary folder for this hard drive to mount temporarily, if you do not need to replace the home partition, this step can be omitted
sudo mkdir/new_home
Mount the hard drive under this folder.
8.
Synchronize the/home folder to this hard disk, and if you do not need to replace it, this step can omit
If you have more files, it can take a long time.
Plus the--exclude option prevents prompting for GVFS permissions issues.
Note: The real command is sudo rsync–axs–-exclude= '/*/.gvfs '/home/. /new_home/.
After syncing, you can see that the New_home folder already has everything under the/home folder, including the permissions of individual users.
9.
Re-mount the hard drive
The following is the details of the/etc/fstab file, and the Fstab file is the configuration file that configures the boot mounted hard disk. UUID can be viewed with the command blkid/dev/sdb, If you do not need to replace the home partition, You can change home to the name of the folder you want to mount
It is also recommended to mount using the UUID instead of the/DEV/SDB1, because the UUID is the unique identifier of the hard disk.
Mount the original/home/on the hard disk mounted in the new folder/old_home/, you can start the purpose of the backup, to be sure everything is normal after the partition can be formatted old_home for other purposes.
Ubuntu Mount 3T new hard drive and replace the home partition