2

I'm planning on uninstalling Windows, which I have currently installed in dual boot with Ubuntu 16.04 LTS. For that I will probably proceed with this method: How do I remove Windows but keep Ubuntu?

The two operating systems are installed on different drives. My question is, after permanently removing Windows and having that drive empty as unallocated space, how can I enlarge the Ubuntu partition to also include that empty drive and be able to use the space of both as one?

Edit: My sudo parted -l output

Zanna
  • 70,465
  • 1
    You're complicating beyond believe. It's so simple as deleting all the Windows partitions and create new ones (or just format). From that moment on Windows is no more, kaput! –  Jul 25 '17 at 01:06
  • Sorry for disturbing, I'm new to this community and still a little unsure about how it works. Now I've reedited my question to fit my needs. – Random Space Thing Jul 25 '17 at 01:38
  • Please edit your question and add a screenshot of the program Gparted. You may have to install Gparted. The screenshot can be uploaded to imgur.com and linked in your question. – user68186 Jul 25 '17 at 14:31

2 Answers2

5

There are basically four ways to use two physical disks in Ubuntu, but only one of them is likely to be easy to set up, given your likely current configuration. (I'd need to see the output of df or sudo parted -l to be sure, though.) The methods are:

  • Mount multiple filesystems -- This is the method that's likely to be easiest for you to set up. Basically, you create a new partition in the freed space and mount it somewhere convenient (say, /home/{yourusername}/morespace). You'd normally create an entry in /etc/fstab to mount the new partition somewhere convenient, as described here. Although this method is easy to set up, it's likely to be awkward, since the partition sizes might not match what you need, and you'll have to access the new space via whatever mount point you decide to use.
  • Use a filesystem with spanning features -- Some filesystems, such as Btrfs, provide spanning features -- that is, one filesystem can span multiple devices (disks). If you're already using such a filesystem, you can probably reconfigure it to expand across the new volume, although I'm not 100% positive that's possible. See the Btrfs wiki for more on this approach generically. If you're not already using Btrfs, converting to use it will require awkward backup-and-restore operations, or moving your installation to Btrfs on the freed disk and then expanding over to the one you're using now.
  • Use RAID -- In a Redundant Array of Independent Disks (RAID) setup, multiple disks are combined together to act like one. Disks can be combined to improve reliability, speed of access, or both. Unless you're already using RAID, though, converting to a RAID setup is likely to be awkward. Note also that there are two types of software RAID and hardware RAID. (Unless you're using a server, you'd probably need to buy a special controller card to use hardware RAID.) See here for information on one of the software RAID types.
  • Use LVM -- Logical Volume Management (LVM) is another way to combine devices. In LVM, one or more partitions (aka physical volumes) are combined together into one volume group, which is then re-allocated into logical volumes. You store most filesystems on logical volumes, rather than directly on partitions. The advantage is that this gives you greater flexibility to adjusting logical volumes than a traditional partitioning scheme provides. Among other things, you can add new physical volumes and expand logical volumes to fill the new space quite easily -- which of course is exactly what you want to do. Unfortunately, unless you're already using LVM, converting to such a setup is likely to be awkward, requiring backup/restore or installation-moving operations similar to what would be required when converting to Btrfs or RAID. See the Ubuntu wiki page on LVM for an introduction to LVM. There is a tool, called blocks, that's supposed to convert to LVM in place, but I've never used it, and AFAIK it doesn't come with Ubuntu.

A default Ubuntu installation uses ext4fs (which does not support spanning) on a plain partition configuration (that is, no RAID or LVM, unless your computer uses hardware RAID). Thus, chances are only the first of these options will be easy to implement for you; however, I can't be positive of that. If you used an advanced installation option, it might have used software RAID or (more likely) LVM, in which case expanding onto the freed space on your second disk may be relatively easy.

If you're got a default straight partition setup but want more flexibility, my suggestion would be to migrate to LVM. You could either re-install entirely or migrate your existing setup. I tried Googling but I didn't find a good step-by-step procedure for doing such a conversion. (I found a couple that were rather vague on some critical details.) It's certainly possible -- I've done it -- but it is awkward and requires either expertise or good instructions. Overall, backing up your user data and re-installing may be the best way to accomplish the goal. Fortunately, with extra space at hand, the backup part might be easy -- you could create an LVM with a new logical volume for /home in the newly-freed space, copy your existing /home there, and then re-install, telling the installer to use the new /home logical volume, then tweak logical volume sizes as desired.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • 1
    Your answer is thorough. You might want to consider replicating it here: https://askubuntu.com/questions/7002/how-to-set-up-multiple-hard-drives-as-one-volume That question is from 2010 before btrfs came out. – WinEunuuchs2Unix Jul 25 '17 at 15:01
  • Is {hardware | software} RAID even a valid choice for a Ubuntu desktop environment? I know it is for the server environment. – heynnema Jul 25 '17 at 15:13
  • Sure, you can set up RAID on a desktop. That said, I don't know offhand if the Ubiquity installer would support it, but there's no reason you couldn't reconfigure a desktop system to use RAID after the fact if you wanted to and if you have sufficient experience (or good enough instructions) to do so. Those really are the hurdles here -- those final three options all require significant hoop-jumping, and the knowledge to enable doing it. The desktop and server versions of Ubuntu differ mainly in what bits they install, not in fundamentals like kernel module availability. – Rod Smith Jul 25 '17 at 16:07
  • I don't think the Ubuntu desktop installer allows it. – heynnema Jul 25 '17 at 16:39
  • Somewhat incredible that there is no guide for a vanilla workstation install with JBOD as a single EXT4 volume under LVM. It's RAID/Encryption examples only. – mckenzm May 03 '19 at 05:48
0

I'd recommend keeping Windows installed. It'll be needed to perform tasks that can only be performed in Windows... like BIOS updates, firmware flashes to USB devices, etc.

If you do end up getting rid of Windows, there's no current way in your current configuration to combine the unallocated space spanning two disk drives... unless you use LVM... but this requires a total system reinstall and reconfiguration... on LVM formatted disk drives. (I'd recommend that both drives be of the same type... ie: SATA, or SCSI, etc.)

See https://wiki.ubuntu.com/Lvm for more info about LVM.

Update #1:

Another way to do this is to make /dev/sda for both Windows and Ubuntu operating systems, and /dev/sdb as /home for Ubuntu. If you wanted to easily share files between Windows and Ubuntu, you'd create a small NTFS partition on one of the drives, and also mount it in Ubuntu by editing /etc/fstab.

ps: I see that /dev/sda has a msdos partition table, and /dev/sdb has a gpt partition table. These should probably be the same type... GPT if you've got a UEFI machine. Neither drive is LVM formatted.

heynnema
  • 70,711
  • I'm currently using a Sony Vaio, which I suppose has only one physical drive. That would mean, according to the info about LVM that you shared, that somehow, maybe an installation program, or maybe I did it without realizing it, a LVM partition was created on my hard drive, and then I installed Windows on one and Ubuntu on the other. Am I right? – Random Space Thing Jul 25 '17 at 02:31
  • Because in that case, without really uninstalling Windows as you suggested, I would like to resize the LVM partitions to enlarge the one with Ubuntu, which is the one I use regularly. However, I'm afraid of screwing the whole thing up, so I would need a little help with that. – Random Space Thing Jul 25 '17 at 02:40
  • If you start gparted you can tell if your disks have a LVM format partition(s). So you have a Sony with 1 internal drive, probably SATA, and 1 external drive, probably USB, yes? I'm not sure the LVM is the way to go with 2 different kinds of drive... internal vs external, and SATA vs USB. Have I got this correct? – heynnema Jul 25 '17 at 03:28
  • Firmware updates can usually (but not always) be done in the firmware setup utility or even with Ubuntu utilities. Even if keeping Windows is desirable, it might be possible to shrink the Windows partition and use most of the disk in Ubuntu, in which case the question remains basically valid. – Rod Smith Jul 25 '17 at 13:30
  • @RodSmith has a point. With or without Windows, one drive could be used to hold one or both operating systems, and place the Ubuntu /home on the second drive. How big are your two drives? Show me a a screenshot of gparted for both /dev/sda and /dev/sdb. – heynnema Jul 25 '17 at 13:45
  • I like having Windows around for gaming and to reboot it when Ubuntu breaks and needs to be fixed from the outside. Then again I sometimes need to boot Ubuntu to fix broken Windows. Life can be a vicious circle at times.... – WinEunuuchs2Unix Jul 25 '17 at 14:59