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.

  • We need more information about your environment. Is .private a file container? Is it a physical disk? It looks to me like you have only 150GB of space for your entire system; how big is the hard drive in your computer? – Thomas Ward Apr 16 '18 at 13:30
  • Yes, I have approximately 150GB for my entire system. How could I know what is .Private. I know that I have encrypted my hard drive when I have installed Ubuntu 17.10. When I opened it, it was just a serie of files and directories beginning by ECRYPTFS_FNEK_ENCRYPTED. I am really not an expert on hardware. Just tell me what you need and I will provide you quickly. – Jeremie Apr 16 '18 at 13:37
  • Note that by changing your question and asking 'What do you suggest" you've made the question an opinion-based-answer attractor, and those types of questions can be closed. – Thomas Ward Apr 16 '18 at 13:56
  • Your new question, by the way, would be 'answered' by following the suggestions in the 'similar' question that you link to - mount the drives at boot time, and then access the data via those two drives/partitions. – Thomas Ward Apr 16 '18 at 14:00
  • The two 2TB drives you mention, are they drives which are internal to the system or are they external USB drives or such? – Thomas Ward Apr 16 '18 at 14:21
  • No, they are internal. – Jeremie Apr 16 '18 at 14:27
  • First, you need to increase your partition size, not your memory, memory is RAM. Second, unless .private is on it's own partition, unlikely, you need to increase the size of the partition .private is on, likely /home or / . See https://askubuntu.com/questions/29866/increase-the-home-partition-without-losing-the-data . If you need to use more than 1 disc, then you need to use LVM. LVM is destructive, meaning you will loose your data. So you would then back up all of home, make your LVM, restore your data. See https://help.ubuntu.com/community/Partitioning/Home/Moving – Panther Apr 16 '18 at 15:02
  • Each of those steps is likely a question of it's own and as .private is encrypted you have a significant risk of data loss or problems with encryption. I would almost suggest backin up ALL your data in your home directory and performing a fresh install with LVM and a large /home directory from the start. I would consider using LUKS (full encryption) rather than encrypting /home , but up to you. – Panther Apr 16 '18 at 15:04
  • LVM - https://wiki.ubuntu.com/Lvm or https://help.ubuntu.com/lts/serverguide/advanced-installation.html or https://www.howtogeek.com/211937/how-to-use-lvm-on-ubuntu-for-easy-partition-resizing-and-snapshots/ – Panther Apr 16 '18 at 15:06

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.stack.imgur.com/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
  • 74,764