0

I have a new hard drive on my server ( a 2 TB drive ) . I want to add this 2 TB to my current /home partition .

The output of df -h

[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       193G  982M  182G   1% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  9.7M   16G   1% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/sda3       1.6T   69M  1.6T   1% /home
tmpfs           3.2G     0  3.2G   0% /run/user/0

The output of fdisk -l :

[root@localhost ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1           40         2048  1004.5K  BIOS boot parti bios_grub-sda
 2         4096    409602047  195.3G  Linux filesyste primary
 3    409602048   3890638847    1.6T  Linux filesyste primary
 4   3890638848   3907020799    7.8G  Linux swap      primary

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Can somebody please tell me how I can add this new 2 TB to my current /home partition and make it a 3.6 TB partition? Thanks

Sven
  • 98,649
  • 14
  • 180
  • 226
matinrazavi
  • 1
  • 1
  • 1

1 Answers1

1

Extremely short form, as this is extensively documented both on SF and elsewhere:

  • Add the new disk as a physical volume to a new LVM volume group (pvcreate, vgcreate)
  • create a new logical volume and file system on this VG (lvcreate)
  • copy the data from the current /home to this new volume
  • mount the new volume as the new /home (umount the current one before)
  • Make sure /etc/fstab references the new device for the /home mountpoint.
  • convert /dev/sda3 into an LVM physical volume,
  • add it to the volume group
  • grow the /home logical volume and afterwards, the file system.

Before doing any of this, make sure you have an up-to-date backup of your system.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • the current /home partition is empty . Does it make any difference in the process ? this is a fresh centos 7 installation – matinrazavi Apr 07 '17 at 13:57
  • No. You can just skip the "copy data" step. – Sven Apr 07 '17 at 13:58
  • I don't understand the answer. This answer is too high level for anyone that would be asking it. What's an LVM volume group and how do you add it? How do you create a logical volume on a VG? Copy should be easy, `cp from/dir to/dir` but don't forget whatever the recursive flag is. How do you mount the new volume, make certain of references, convert `dev/sda3` to an LVM physical volume, add it to a group or grow `/home` logical volume? – Altimus Prime Aug 13 '17 at 05:06
  • @AuntJamaima: Then this is not the site for you. [SF] is a site for pro administrators exclusively and answers here are expected to help you help yourself. You can easily look up all the terms I listed and learn more about them. – Sven Aug 13 '17 at 06:41