Ubuntu: Ubuntu Installation Partition


I have two ubuntu versions installed in my system: 12.04 and 14.04. How do I know which partitions (home and root) belong to which version, without depending on size of the partitions?


The best way is to check all the partitions for a file called /etc/os-release. That file identifies the Linux distribution and version. If you're doing it "by hand," you can use any number of lines. If you want a script to do something with the information, you should probably focus on one line. Here's the file from an Ubuntu 14.04.3 installation:

NAME="Ubuntu"  VERSION="14.04.3 LTS, Trusty Tahr"  ID=ubuntu  ID_LIKE=debian  PRETTY_NAME="Ubuntu 14.04.3 LTS"  VERSION_ID="14.04"  HOME_URL="http://www.ubuntu.com/"  SUPPORT_URL="http://help.ubuntu.com/"  BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"  

Once you've found that file, you can check /etc/fstab on the same partition for identification of additional partitions associated with the installation. In a default Ubuntu setup, these will identify other partitions by UUID values, which you can obtain from blkid, as in:

$ sudo blkid /dev/sdc3  /dev/sdc3: UUID="5028fa50-0079-4c40-b240-abfaf28693ea" TYPE="ext4"  

If you use LVM, the /etc/fstab file will most likely refer to logical volumes by device ID, as in /dev/mapper/ubuntu-home. There are other legal formats in /etc/fstab that might be used if you edited it manually, too.

Again, doing this by hand will require some digging about, but it can be scripted if you want to build a tool to piece it all together automatically.


You can check the label of the kernel. Here's an answer that includes a list of all the Ubuntu versions and which kernel they use: https://askubuntu.com/a/517140/366676.

You can easily mount the /boot/ partition on any modern device.

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