0

I searched a lot on the internet but have not find an exact match for this question, so don't downvote this question just yet.

So, I have Linux Mint 32-bit installed on my computer and I'm running out of space because my original disk is small. I have an external usb disk with 300Gb and so I was thinking of connecting it to the computer and put it to function as another partition where I can install programs.

My questions are:

  1. Can I do this easily?
  2. What happens when I disconnect and then connect again the usb storage disk?
  3. Does the usb disk need to be formatted and/or does one need to put a linux OS in the disk?
  4. If the answer to "can I install programs to the external usb" is yes, when I execute the programs from that mounted partition i.e. the external usb drive, are they going to be slower? And does the answer depend on whether the drive is a USB 2.0 or USB 3.0 (or eSata)?

1 Answer 1

1

Take a look at this question: http://ubuntuforums.org/showthread.php?t=1574068 There is a way to do what you ask for but not directly though. First you'll need to be on a Live USB session. Now in your USB hardisk, create a Linux partition (ext4 is preferable) and copy the entire /usr directory from the flag drive to the usb drive. After that you'll need to edit /etc/fstab to change the mount point of the existing/usr IN THE FLASH DRIVE to point it to the USB drive.

Edit:

Almost forgot, don't even think about un-mounting the hard drive once the process is done. It might be a disaster.

Edit2:

Procedure:

1) Place your Ubuntu Installation disc into the drive and boot to Live Session (Try Ubuntu).
2) Now, open the terminal (Ctrl+Alt+T) and run the below code and press Enter.

sudo passwd root

Type in a password for the root account (moving /usr directory is best using su rather than sudo as it might not turn out well and so, we defined a root password.

3) Now, connect the external hard disk and wait for it to show up. Backup any data on the drive as we will be FORMATTING it soon.

4) a) Next step is locating the root partition (/ partition). In the terminal, run su - and type in the root password you have set up in step 2.
b) Type fdisk -l /dev/sda where /dev/sda is the internal disk of the computer.
c) (i) It will list out all the partitions of your hard drive. Here, use the trial and error method, we will determine the / partition.
(ii) Type mkdir temp in the terminal. This will create a directory called temp at /root/.
(iii) Type mount /dev/sdax temp (where x is any linux partition you found in step 4.b
(iv) Type ls temp and see if you have lot of directories like bin, etc, usr, etc.
(v) If yes, proceed to step 5 or type umount temp and go back to step 4.3 (increment the value of x this time).
Note: The umount command is important to free the temp folder we created for mounting the partitions

5) Since you have the found the root partition, it is time to create a Linux partition on the external harddrive. Install gparted from the commands:

apt-get update && apt-get install gparted -y

gparted is recommended to perform such delicate operations as there is a chance of ERASING THE WRONG PARTITION.

6) Open gparted by typing gparted on the terminal. You will see a window like this: Here, change the device to your external harddrive by using the drop down list on the top-right of gparted.
7) Click on each partition in the list (like /dev/sda1,/dev/sda2 etc.) and press the Delete key on the keyboard.
Repeat the step to delete all the partitions and goto Partition>New.
8) Select ext4 on "File System" drop-down list at the window.
9) Click on the green tick mark to confirm the actions and wait while the external harddisk is partitioned.
10) Now close gparted and open Nautilus and mount the newly created hard drive.
11) Now, on the terminal type 'mv /usr /dev/sdb1 --verbose (mostly the external harddrive WILL be /dev/sdb1 but make sure you are mounting the right one.)
12) Wait patiently until the directory is moved to the hard drive.
13) Now, we have to edit the mount points to add the new path of /usr directory.
14) Type sudo blkid > ids on the terminal to print the UUID of all the devices connected to Ubuntu. This step is mandatory as by default, UUID's are used by Ubuntu in /etc/fstab
15) Open the ids file we created in step 14 using gedit or Nautilus (your wish and copy the UUID part of the external harddrive)
16) Now, go to the previously opened terminal (or if it is busy or you closed it, open the terminal again and type su -c)
17) Type gedit /etc/fstab to open the fstab file and now add the /usr entry as:

<uuid-here> /usr            ext4    rw              0       1

and save the file.
18) Now, reboot the desktop. Don't unplug the USB HDD but take out the installation disc from the cd drive.

IF everything works out, you will see the Ubuntu login screen. Good luck!

1
  • Although your answer is 100% correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... :-( Therefore, please edit your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! ;-) You can always leave the link in at the bottom of your answer as a source for your material...
    – Fabby
    Commented Mar 15, 2015 at 0:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .