Ubuntu: Reinstall ubuntu to SSD without any changes to home portion in HHD



Question:

My desktop computer had 16Gb SSD and 1Tb HHD, so I decided to installed root drive / to 16Gb SSD and /home to 500Gb ext4 partition in HHD, and I created another two 220Gb ext4 partitions in remaining HHD space, installation was successful and system ran smoothly for two year until my SSD was broken and computer stop booting, I checked HHD and its working fine

My problems are

  1. I bought a new 32Gb SSD, I need a safe way to install ubuntu root drive / to new SSD and still use my old /home in HHD drive without any changes (/home and other two partitions are filled with important data i cannot loose)
  2. In previous installation i used Ubuntu 14.04 LTS and now i like to use Ubuntu 16.04 LTS is it a problem? or should i use 14.04 again


Solution:1

Be aware that safety is relative. There is no 100% safe way to do what's requested, since there's always the possibility of a disastrous mistake, hardware failure, data-eating bug, etc.

That said, ravery's solution will certainly get the job done, and it may be marginally safer than what I'm about to suggest (which is an elaboration of what oldfred suggested in his comment), but this method is certainly simpler and easier:

  1. Physically connect the new SSD.
  2. Launch the Ubuntu installer.
  3. When you get to that point, select the "Something Else" installation option.
  4. Set up your SSD with your Ubuntu root (/) partition and possibly (depending on your boot mode and partition table type) an EFI System Partition (ESP) or BIOS Boot Partition. You might also want a swap partition on the SSD, although there are arguments against this practice.
  5. Still in the partition management screen, select each of the partitions on the hard disk and set mount points for them -- /home for that partition and wherever you want to mount the other partitions. (Contrary to what oldfred wrote, it is possible to set other partitions to mount when you install Ubuntu. If they should be mounted at unusual locations, you'll have to specify those locations by typing them rather than selecting them from a list, but it is possible. I do this frequently myself.)
  6. Double-check that the partitions you want to preserve from your hard disk are NOT set to be formatted! This is the dangerous part of this procedure, compared to ravery's -- if you make a mistake, you could easily trash your existing partitions!
  7. Proceed with installation.

When you reboot, your system should boot up normally and you'll be able to log in to your existing environment from the previous installation. It's likely that everything will "just work," with the caveat that you may need to install programs that you'd installed in 14.04 but that aren't part of a stock 16.04 installation.

Concerning safety, it's hard to judge how much riskier this is than ravery's solution. I do this type of installation frequently and I've never had a problem with it -- but I'm very cautious when I set up /home and other preserved partitions. I've seen horror stories from people who make mistakes with this, so it certainly is possible to get it wrong and lose your data.

The up side, of course, is that this procedure is simpler and more automatic. You're less likely to run into problems because of a mistyped text-mode command or an error when cutting-and-pasting UUID values. IIRC, a GUI login will be impossible if you reboot and /home isn't properly mounted after following ravery's procedure, so a text-mode login or repair via the installation medium will become necessary, and either of these approaches raises the level of expertise needed to repair the system.

Thus, you've got a tradeoff, largely between safety and convenience, but with a different type of risk even in the (mostly) safer approach. I really can't firmly recommend either approach in any sort of universal way; you'll just have to decide for yourself which way sounds more comfortable.

One more point: If you're installing in EFI mode, you should be aware of this bug, which causes blank drives to be incorrectly identified as holding a BIOS-mode installation. The solution is to use GParted, gdisk, or some other tool to create at least one partition on the disk before running the Ubuntu installer. This bug could hit whether you use my or ravery's solution; it depends on the state of the disk before you even get to making the decisions about how to partition and install Ubuntu. You probably wouldn't hit that bug if you use ravery's approach and one of the automated partitioning options, but I'd be wary of using an automatic partitioning option if you've got a disk with data you want to preserve -- the installer might decide it should install to that disk and create a mess.


Solution:2

The safest way would be to Install ubuntu to the SSD, then create your mount points and edit /etc/fstab to auto mount them.

first install ubuntu to the 32 GB SSD, use all space with /, swap, and EFI par titions.

Next use gparted to get the UUID of the partitions on the HDD. Click the partition, then in the pull down menu Information. record the UUID's

First mount home partition. sudo mount /dev/sdb# /home
change # to the partition number for your home partition

Next, create the mount points for the two data partitions.
sudo mkdir /path/to/mount

Last, edit etc/fstab to add automount entries.
for each partition you need to add a line in the following format:

UUID    mount point   file system type  options dump   pass  

Thus you would add three lines like this:

UUID=(IDofHomePart)  /home          ext4   defaults  0  2  UUID=(IDofDataPart1) /path/to/mount ext4   defaults  0  2  UUID=(IDofDataPArt2) /path/to/mount ext4   defaults  0  2  

then reboot


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »