0

I have an Ubuntu when booted it has the root system is stored under /dev/sdb1, as can be shown with df command:

enter image description here

the fdisk -l looks like this:

enter image description here

My question is how can I change the root system from /dev/sdb1 to /dev/sda2? And when boot also goes to /dev/sda2

  • In other words you want the otjher device /dev/sda2 to boot rathan the current one or you want to move the OS from /dev/sdb1 to the new location? – George Udosen Nov 14 '18 at 7:26
  • @GeorgeUdosen That's right! – scamander Nov 14 '18 at 7:27
  • bro please be very clear what you want, to move the current OS to a new location or ask the system to boot from else where? – George Udosen Nov 14 '18 at 7:33
  • 1
    Why exactly do you want this? It may be possible in theory, but one mistake and you will mess up your machine big time. – Jos Nov 14 '18 at 7:52
  • 1
    Leave your root partition where it is (as long as it is large enough to fit the software) and store your data on an external disk. That is very easy. – Jos Nov 14 '18 at 7:58
2

Reinstalling the OS on sda would be the safe way, but isn't really needed. Since you have a filesystem on sda2, either:

  • if you can use it entirely for you data, create a mount point on your sdb1 filesystem here you want the data, and mount it there (add to /etc/fstab).

  • otherwise, mount it (under root or else, still by adding to /etc/fstab), create a directory in it for your data, and create a soft link to it from where you want need your data to be.

1

To change mount points, we must edit the fstab file (see link above), so let's open it and have it fork to the background with the & symbol. For Ubuntu, open a terminal and run:

gksudo gedit /etc/fstab &

Locate the entry you want to change. Let's say you discover that the device is /dev/sdb1. Then you will change the line in fstab from something like

/dev/sdb1       /media/disk2    ext3    defaults,errors=remount-ro  0  2 

to

/dev/sdb1       /mnt/backup     ext3    defaults,errors=remount-ro  0  2  

Source: https://help.ubuntu.com/community/MoveMountpointHowto

  • does this method also boots on /dev/sda2 ? I want all the software (e.g. Apache, MySql, etc to be installed in /dev/sda2 ). In short to use /dev/sda2 it as main device. – scamander Nov 14 '18 at 7:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.