Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to know how to install a second hard drive in Xubuntu 14.04. Taking in mind that I already installed Xubuntu in another hard drive. I just want to add more storage to it. Also the other hard drive has Windows XP installed in it and I just want to delete it off. I want to add all the extra storage to the existing hard drive that has Xubuntu.

# Use 'blkid' to print the universally unique identifier for a 
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5). 
# 
# <file system> <mount point>   <type>  <options>       <dump>  <pass> 
# / was on /dev/sda1 during installation  
UUID=f0212a60-ad55-43d9-9418-8b9d6bea832d /               ext4   errors=remount-ro 
# swap was on /dev/sda5 during installation  
UUID=8bdc6e45-c488-4400-9a1c-aa1dc2722a39 none            swap    sw    
UUID=1579e689-3965-47db-83a7-665cceeb6aff /media/bigdata  ext4    defaults

I followed dan08 steps, the drive is mounted in bigdata everything is fine the only thing is that I can't move anything to it like files. Is like I need a permission or something in order to paste or move a file to it. This is what I get when I try to move a file to it. Error opening file '/media/bigdata/uninstalling wine.odt'. Permission denied.

How do I use chown to change my permissions in my new drive, so I can copy and paste on it?

**When I go to the new partition drive and I open the terminal in that location and I type Ls -L this is what I get total 16 drwx------ 2 root root 16384 Jul 3 10:05 lost+found

edit: I got it to work I just had to change the permissions with chown after mounting the hard drive.

share|improve this question
    
If you want to increase your current hardrive space with the hard drive that has windows xp on it, it means you want to create a raid array and for you to do that, you'd have to do it before you installed anything on both hardrive with the bios. If you want the extra space of the other hard drive, you will only have to connect it to your computer and format it. Your computer should automatically detect it and it can also be set up as dual boot if you decide not to format it –  Tatakai Wasumi Jul 1 at 1:46
    
I edited your post. You had a few extra characters in there. Change your fstab accordingly and try mount again. –  Captain Giraffe Jul 1 at 1:48
1  
I see I dont have enough rep to get auto approved on edits. The last line in fstab should read UUID=1579e689-3965-47db-83a7-665cceeb6aff /media/bigdata ext4 defaults –  Captain Giraffe Jul 1 at 1:50
    
@CaptainGiraffe I think that did the job. I reboot it and I didn't have any problems like last time. I do have another quick question when I try to move files to this drive it doesn't let me. Is that because now the two drives are converted into one and when the memory in the primary drive is full the secondary drive is going to kick in. Thanks by the way how can I give you the rep points. –  jart Jul 1 at 2:01
1  
@jart no the free space is now only available to the directory /media/bigdata, anything in that directory will use the new drive. You might want to ask a new question on how to use that directory in the most convenient way. It would include symbolic links. If you can't put stuff in /media/bigdata you will have to look for examples of chown (change owner). It might be that the root user is the owner of that directory. –  Captain Giraffe Jul 1 at 2:10

6 Answers 6

Step 1) Connect the drive. Wipe the drive if desired.

a) If you have data on the drive that you need to keep, back it up.

b) Fill the drive with zeros which will blow away the MBR and all data by:

sudo dd if=/dev/zero of=/dev/sdX

**or** if you want a progress report as you wipe the drive use

sudo dc3dd wipe=/dev/sdX in both cases sdX should be changed to sda, sdb, or whatever drive you are wiping. wipe

If you are not certain, you can identify the drives using fdisk -l

source: Remove lvm to install Ubuntu

Step 2) Partition the drive. I use gparted.

a) open gparted - your password will be required

b) select the drive you are working with in the box on the upper left

You will see similar to this:

gparted1

c) create a new partition table. I won't be discussing partition table types here as that's beyond the scope of this answer.

From the menu choose device and then create partition table.

gparted2

Click apply - Gparted will apply the change and rescan the disks

d) format with a filesystem of your choice. I will use ext2 in this example. choose the filesystem that you prefer. ext4 is my preferred filesystem.

Right click on the unallocated line and select new, adjust settings if necessary here then click add.

gparted3

Step 3) Format the drive (put a file system on it) I used ext2 (the default)

gp4

Click the green check mark to apply the format. You will be warned. Click apply

gp-process

When the process is complete you'll get the below. you can expand details as needed then click close.

gp-complete

source: experience - full manual is here: http://gparted.org/display-doc.php?name=help-manual

Step 4) Mount the drive: Where you mount it is where the space will be. I will mount to the empty directory at /srv using old-school methods. You can use blkid as covered elsewhere on the site if you so choose.

In the image below you can see that I ran fdisk -l to insure I had the right drive designation prior to running the mount command `sudo mount /dev/sdc1 /srv

mount1

Step 5) Set permissions at the mount point properly so that the appropriate users/groups can use the drive - currently only the owner root has full access.

sudo chmod -R 777 /srv will give full read/write/execute access to the drive for everyone. Restrict as you see fit. for more information on permissions see the chmod man page.

source: experience, man chmod

You can also change ownership on the drive with chown if desired. See the man page for chown by running man chown in a terminal. If you wish to have the drive mounted every time you boot, you'll need to edit fstab (some would call this a permanent mounting). Editing fstab has been covered in great detail both here and elsewhere on the site. for an example issue the command cat /etc/fstab which will show you the current list of drives and with what options they are mounted at boot. cat /etc/mtab will show you all current mounts.

share|improve this answer
    
I did the steps from up top by the user dan08, the drive is mounted in bigdata everything is fine the only thing is that I can't move anything to it like files. Is like I need a permission or something in order to paste or move a file to it. This is what I get when I try to move a file to it. Error opening file '/media/bigdata/uninstalling wine.odt'. Permission denied. –  jart Jul 3 at 15:23
    
Proceed with step 5 from my answer. in your case replace /srv with /media/bigdata . When you do an ls -l you should get drwxrwxrwx 2 root root 16384 Jul 3 10:05 lost+found. the d signifies a directory. rwx indicates read write execute permissions for owner, group, and everyone else respectively. –  Elder Geek Jul 3 at 16:16
    
thank you that did the job @elder geek –  jart Jul 3 at 17:10

To simply use the drive as an extra storage space

  1. Connect the drive however you need to. Open a terminal (default CtrlAltT) and type ls /dev to figure out the name of the drive. Probably sdb.

  2. Open gparted and make sure you select that drive from the dropdown in the upper-right.

  3. Select Device->create partition table.

  4. Create on large partition and format it to ext4. Give it a label of "data" or something. note the name of the partition, probably sdb1

  5. Use sudo blkid /dev/sdb1 to get the UUID of the partition. Take note of this UUID, as you'll need it later.

  6. Create a directory that will be the mount point for the drive mkdir /media/bigdata should work.

  7. Add a line to /etc/fstab by using (sudo nano /etc/fstab) to automatically mount the partition on boot:

    UUID=<the drives uuid>  /media/bigdata    ext4   defaults 0 2
    
  8. Run sudo mount /media/bigdata or reboot.

And you're done.

share|improve this answer
    
when I use mkdir media/bigdata I get cannot create directory ‘media/bigdata’: No such file or directory –  jart Jun 30 at 21:40
    
@jart that should read sudo mkdir /media/bigdata. You should set the mount point to a directory where you want this free space located. The directory needs to be empty. You might want to change the owner of that directory too, see chown. –  Captain Giraffe Jun 30 at 22:59
    
I prefer to mount in /mnt, but many discuss which is better or more correct. sudo mkdir /mnt/bigdata AND: sudo chmod -R a+rwX /mnt/bigdata AND sudo chown -R $USER:$USER /mnt/bigdata –  oldfred Jun 30 at 23:07
    
@CaptainGiraffe when I input the command sudo mkdir /media/bigdata I get nothing and when I try to input the command again I get this mkdir: cannot create directory ‘/media/bigdata’: File exists. please help thanks. –  jart Jul 1 at 0:03
    
@oldfred input please –  jart Jul 1 at 0:03

You mentioned that you wanted to delete Windows XP so this example will completely delete and format the new spare hard disk (backup and save any data you do not want to delete).

Open "gparted" or run the command sudo gparted in an open terminal.

Look for the newly added storage drive, right click on it, select format to > ext4, click the icon to apply the changes and select to accept the changes before closing gparted. This will delete and reformat the drive to ext4.

Now, backup fstab with this command:

sudo cp /etc/fstab /etc/fstabcopy

Edit fstab:

sudo nano /etc/fstab

Remove or delete all the stuff YOU wrote to /etc/fstab and do NOT delete the original entries from your installation. When you are done, use CTRL + o to write the changes, press ENTER to accept the changes and use CTRL + x to exit the file.

Now, run:

sudo blkid

Here is an example output:

/dev/sda1: UUID="e7444e4d-f844-4724-b17b-a4449244481j" TYPE="ext4" 
/dev/sda2: UUID="5444cdcf-4443-40b9-af38-1444cd4448da" TYPE="swap" 
/dev/sda5: UUID="99444f5c-7444-4ee7-b550-79bd2444b0fw" TYPE="ext4" 
/dev/sdb1: UUID="1579e689-3965-47db-83a7-665cceeb6aff" TYPE="ext4"

You can see in this example, the lone only single partition with no swap space is listed as /dev/sdb1. I will use the UUID in the example below.

Run:

sudo nano /etc/fstab

and enter the following line using the proper UUID that was listed when you used the blkid command earlier. Here is the example line you need in fstab:

UUID=1579e689-3965-47db-83a7-665cceeb6aff /media          ext4    defaults 0       1

When you are done, use CTRL + o to write the changes the file, press ENTER to accept the changes and use CTRL + x to exit the file. Save any other unsaved work and reboot the computer.

You do not need to mount the drive after you reboot.

After you reboot the drive will no longer show as a seperate device in Thunar.

To access the storage drive after you reboot, open Thunar and go to the file /media, this is where the drive is now mounted.

To mount the drive in a seperate folder, edit the fstab entry to read /media/storage instead of /media (or name it /media/awesomefilename . . . whatever you want).

share|improve this answer
    
quick question in Gparted did I have to create this new drive as a primary partition or a extended partition. –  jart Jul 3 at 2:29
    
everything worked well but when I try to copy and paste or move a file to that folder it doesn't let me. The file that I try drag and drop reverts back as it doesn't want to be move to this location. Is as the drive is locked same goes for my original drive where I have my OS installed on. In my original drive if I try to copy and paste something into my file system drive it doesn't let me. –  jart Jul 3 at 2:49
    
make sure you have both ownership and write permissions to do this, for example, assuming your user name is "jart", run: sudo chown -R jart:jart /media for ownership. For write permission: sudo chmod -R 755 /media You only have write permission to copy and paste into your home folder of your OS unless you are root. If you do not have write permission to your home folder anymore, run sudo chown -R jart:jart ~/ If you need to modify system files in folders such as /etc or whatever, just open thunar as sudo sudo thunar and you will have write permission over system files but be careful. –  mchid Jul 3 at 17:14
    
I got it to work thanks –  jart Jul 3 at 18:50

besides the mentioned, since you said xubuntu, I'm assuming you run a desktop operating system.

Uubuntu (plain) by itself for desktop tasks doesn't grow that much, and usually 10GB for / is enough for day to day usage. However, your /home/ folder might start getting bigger in time, if you go online, save data, modify data, run programs, etc..

If you are like me, and save documents in you /home//Documents-music-etc.. then a good idea would be to move the /home folder to a bigger partition/hard drive.

In linux you can literally mount chuncks of the system on different devices and it will work.

Thus in recovery mode you could do the following:

install rsync and format the new hard drive as an ext4 chunk.

mount it in a temporary location and rsync the data from the old to the new one.

mkdir /tmp/tmp_home
mount /dev/newpart /tmp/tmp_home
rysnc -avpr --delete --sparse --progress /home/* /tmp/tmp_home/

change your fstab to mount the new partition as /home

UUD=<new partition> /home <type> defaults   0 2

reboot into normal mode and check if things are working once you synced the data on the new drive.

reboot back into recovery mode and delete the data from the old drive, once you made sure your new home works. make sure you don't nuke your home directory on the new partition..

umount /home ; rm -rf /home/*

now you would have old space - sizeof(/home) occupied on the original drive, and all your data in that directory on the new drive with both drives as a dependency.

This is safer and is somehow a just a bunch of disks setup than using them in pools/raid0 format. In this case if one drive fails.. you still have the other.

share|improve this answer
    
so this is how my entry would like? UUD=1579e689-3965-47db-83a7-665cceeb6aff /home defaults 0 2 what is the type part for <type> –  jart Jul 3 at 3:30
    
they type you format it as.. For me I have / on reiserfs .. don't ask.. and /home on btrfs with builtin raid1. I merely suggested another option available, if you don't want to work on the disk level, you can split in the folder hierarchy. And as stated it's up to you to decide how you want to use it, based on your needs. –  user283885 Jul 4 at 18:41

Though the above will work, I'd do this as I am lazy (slash then rebuild).

Use Gparted to view the drive through the GUI. find and clean/delete the drive partitions, add a new primary partition. this will effectively reset the permissions on the drive partitions as they will be destroyed too.

sudo apt-get install gparted

also when on the root of the partition you cannot copy files to, you can do a chmod:

sudo chmod -R 777 /whereeveryourdrivenameis

you can check gparted for the location of the drive you'll like to process.

share|improve this answer

Open a root session of nautilus or your file manager, go to the drive after using gparted to wipe it, right click in the root of the drive and go over to the permissions tab. Go to advances or your manager's equivalent and set the group to "users" and owner to your user name, make permissions for the owner and group (if you like) full access with permissions to both create and delete folders and files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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