0

I have already asked a similar question, but my question was poorly worded. Although heynnema wrote a good answer, it is not exactly what I was expected. So here is a new version better worded.

┌─╼ [~/grive]
└────╼ sudo fdisk -l
[sudo] password for infinity: 
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: CBF0E7EB-2677-4D68-B9B5-C9212D0CF17A

Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M EFI System
/dev/sda2  1050624   2549759   1499136   732M Linux filesystem
/dev/sda3  2549760 468860927 466311168 222.4G Linux filesystem


Disk /dev/sdb: 1.8 TiB, 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
Disklabel type: dos
Disk identifier: 0x96196249

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 3907026943 3907024896  1.8T  7 HPFS/NTFS/exFAT


Disk /dev/sdc: 1.8 TiB, 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
Disklabel type: dos
Disk identifier: 0x9619624a

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdc1        2048 3907026943 3907024896  1.8T  7 HPFS/NTFS/exFAT




Disk /dev/mapper/sda3_crypt: 222.4 GiB, 238749220864 bytes, 466307072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/ubuntu--vg-root: 154.4 GiB, 165767282688 bytes, 323764224 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/ubuntu--vg-swap_1: 67.9 GiB, 72926363648 bytes, 142434304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/cryptswap1: 67.9 GiB, 72925839360 bytes, 142433280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

┌─╼ [~/grive/Data_HFT/TnS]
└────╼ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                          34G     0   34G   0% /dev
tmpfs                        6.7G   11M  6.7G   1% /run
/dev/mapper/ubuntu--vg-root  151G  114G   30G  80% /
tmpfs                         34G   27M   34G   1% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
tmpfs                         34G     0   34G   0% /sys/fs/cgroup
/dev/sda2                    705M  401M  253M  62% /boot
/dev/sda1                    511M  4.7M  507M   1% /boot/efi
tmpfs                        6.7G   16K  6.7G   1% /run/user/121
tmpfs                        6.7G   44K  6.7G   1% /run/user/1000
/home/infinity/.Private      151G  114G   30G  80% /home/infinity

sudo fdisk -l made a list of all existing hard disks on my computer and df -h listed the hard disks use on my computer.

I wish to increase the memory of /home/infinity/.Private from 152G to 151G + 1.9T + 1.9 = 3.951T. I have two unused hard disks /dev/sdb and dev/sdc.

heynnema said in my previous question :

if your final goal was to make your /.Private larger by adding two 2TB disks to it, you should have said so earlier, 'cause that requires a different approach. What does making /.Private=3.95TB any different than using the disks mounted separately as you're doing now. If you still want to do that, I'd recommend using LVM disks... but that's a whole new question.

So how could I increase the global memory without losing information? I don't want to reinstall everything. If it is not possible to do it without reinstalling everything, how could I create another home?

I will explain to you what would be the purpose of that new space. I need to store around 300GB of data for machine learning purpose so that I could use it locally.

1 Answers1

0

This question was made a Community Wiki post because while this is technically my answer, I borrow off of others' answers, and do not deserve any reputation gains from this as a result.

In theory, you can build an LVM which will cover the entirety of the three disks, however we need a bit more information to determine if this is the proper route. Namely, we need to know if the two 2TB disks you mention are internal drives or external hard drives.

If they're external hard drives, then the original answer from heynnema is valid and needs to be followed.

If they're internal drives, then in theory following the "Add another drive to your volume" part of this answer here by Jacob Schoen would probably be waht you need to do:

Adding another drive to your volume

  • So follow the steps in the first bullet again but for the new drive.
  • Now if the drive name is /dev/sdb1 then do sudo vgextend media /dev/sdb1 to add it to the volume.
  • Now we need to unmount the volume. To do this do sudo umount /dev/media/volume.
  • Now you can see the stats on your volume now by running sudo vgdisplay. The important part is Free PE / Size. You need to know how much space you can add to the volume for the next https://i.sstatic.net/jLgkr.jpg?s=64&g=1step.
  • So if you had 150 Gb of space you would do sudo lvextend -L+150G /dev/media/volume.
  • Now run sudo e2fsck -f /dev/media/volume to check the filesystem.
  • Now run sudo resize2fs /dev/media/volume to resize everything.
  • You can run the stats again and verify that Free PE / Size has dropped to what you expect.
  • Remount the volume by doing sudo mount /dev/media/volume /mnt/media
  • Rinse and repeat for any other drives.

Also something that I found helpful was I had files I needed to copy off of disks to the LVM I created before I added that disk. So I used cp -r -v so that it would recursively copy files and use the verbose output so I know what it was doing. An example of the full command would be:

cp -r -v /mnt/temp/Movies /mnt/shared/media

Where /mnt/temp/Movies is the folder you want to copy from.

Regardless of which method you choose, you should always back up your data before doing any system changes.

Thomas Ward
  • 78,878