Ubuntu – Using free space from a drive (sda) onto another (sdb)

disk-usagepartitioning

Can you please help me to move free space from Windows drive to Ubuntu drive?

I've installed Ubuntu 16.04 alongside Windows with default options and quickly ran out of space.

sda is the windows drive and sdb is Ubuntu's.
As you'll see in the screens, there's a 122.66GiB unallocated on sda (after sda5), which I need to use to enlarge sdb3

gparted screens.

sda
sdb

fdisk -l dump

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 35E3D2B8-62DD-43FF-9C2E-C7417E4BC37E

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1026047   1024000  500M EFI System
/dev/sda2  1026048   1107967     81920   40M unknown
/dev/sda3  1107968   1370111    262144  128M Microsoft reserved
/dev/sda4  1370112   2373631   1003520  490M Windows recovery environment
/dev/sda5  2373632 719532031 717158400  342G Microsoft basic data


Disk /dev/sdb: 29.8 GiB, 32017047552 bytes, 62533296 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: gpt
Disk identifier: 8A191FC2-11E1-4FA7-A403-0E86CD7102CE

Device        Start      End  Sectors  Size Type
/dev/sdb1      2048 16775167 16773120    8G Intel Fast Flash
/dev/sdb2  16775168 17825791  1050624  513M EFI System
/dev/sdb3  17825792 54202367 36376576 17.4G Linux filesystem
/dev/sdb4  54202368 62531583  8329216    4G Linux swap

Adding storage devices details:

   *-scsi:0
        physical id: 9
        logical name: scsi0
        capabilities: emulated
     *-disk
          description: ATA Disk
          product: WDC WD5000LPVT-7
          vendor: Western Digital
          physical id: 0.0.0
          bus info: scsi@0:0.0.0
          logical name: /dev/sda
          version: 1A01
          serial: WX81A53V0157
          size: 465GiB (500GB)
          capabilities: gpt-1.00 partitioned partitioned:gpt
          configuration: ansiversion=5 guid=35e3d2b8-62dd-43ff-9c2e-c7417e4bc37e logicalsectorsize=512 sectorsize=4096
  *-scsi:1
       physical id: a
       logical name: scsi1
       capabilities: emulated
     *-disk
          description: ATA Disk
          product: LITEONIT LMS-32L
          physical id: 0.0.0
          bus info: scsi@1:0.0.0
          logical name: /dev/sdb
          version: 10C
          serial: TW0H9R7V5508535E0723
          size: 29GiB (32GB)
          capabilities: gpt-1.00 partitioned partitioned:gpt
          configuration: ansiversion=5 guid=8a191fc2-11e1-4fa7-a403-0e86cd7102ce logicalsectorsize=512 sectorsize=512
  *-scsi:2
       physical id: b
       logical name: scsi4
       capabilities: emulated
     *-cdrom
          description: DVD-RAM writer
          product: DVD+-RW GU70N
          vendor: HL-DT-ST
          physical id: 0.0.0
          bus info: scsi@4:0.0.0
          logical name: /dev/cdrom
          logical name: /dev/cdrw
          logical name: /dev/dvd
          logical name: /dev/dvdrw
          logical name: /dev/sr0
          version: A104
          capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
          configuration: ansiversion=5 status=nodisc

Best Answer

You can't move (free) space from one drive to another but you can still make the free space available to your Ubuntu system.

Method 1: Use plain partitions

This is the more simple albeit far less flexible variant. The basic idea is to:

  1. Decide which data you want to store on or move into the now free space.

    • You could create a new volume and “mount” it at /media/pehuen/my-data or /mnt/my-data or pretty much wherever you like and store some of your files and data there.

    • You could have all of /home including your (and other users') personal files and data in a separate partition. For this one refer to the excellent “How can I move my /home directory to another partition if it's already part of the / partition?”.

    • In a similar fashion you can move all of /usr, /opt or /var onto a separate partition (though that's a little more complicated to manage if you ever run into boot issues).

    • You can choose more than one or all of the above.

  2. Create one or more new partitions in the free space.

  3. Depending on your decision on step 1, move the affected files to the new partition(s).

  4. Configure your system to “mount” the new partition(s) at boot.

Method 2: Use logical volumes

This is more complicated and requires more work and is mostly for advanced users. Logical volumes let you aggregate multiple physical partitions/volumes into one or more logical volumes that span one or more (or all) of the physical volumes. This allows you to add or remove physical storage as needed while you can grow and shrink existing or add new logical volumes very flexibly.

In theory you can have your entire Ubuntu installation including all system files and personal data inside a single logical volume that spans thousands of physical drives. A little additional work is required to get Grub to boot Ubuntu from a logical volume though.

Conclusion

There are two basic methods how you can integrate the free space from a different disk into your Ubuntu setup. They provide different degrees of flexibility at the cost of a great deal of complexity in setup and maintenance. Both require you to make a decision how you want to organise your data.

If you made your decision and laid out a basic, abstract action plan, you're welcome to open a new question on how to flesh it out and/or implement it. Send me a notification in the comments if you want to draw my attention to the new question. Please don't extend your current question with such a broad follow-up question since it would invalidate previous answers and make things more difficult to follow for future readers.