Hard disk mistake

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
notwatson
Level 1
Level 1
Posts: 33
Joined: Mon Jan 09, 2012 3:22 pm

Hard disk mistake

Post by notwatson »

Hi,

I've been an avid user of LINUX (using PCLINUXOS) since 2006 but have just installed Mint (10) here. I am absolutely loving every moment - it feels like I just arrived home ! Mint rocks.

I'm not sure where to ask this question so I'll put it here...

Here's my problem: I have two 80GB hard disks.....

/dev/sda is as follows:
/dev/sda1 linux-swap: 4.66GB
/dev/sda2 extended 72.04GB
/dev/sda5 ext4: 33.53GB mount point /
/dev/sda6 ext4: 38.51GB mount point /home.
This hard disk is just how I wanted it. (not sure why the sda numbers are like that, but it's working fine...)

The problem is with the second disk. Deep breath......
/dev/sdb is as follows:
/dev/sdb1 ext4 74.53 GB mount point /usr/local

If I browse /usr/local I see folders I would expect: "bin" "etc" "games" "include" "lib" "lost+found" "man" "sbin" "share" and "src".
The really odd thing is that this folder is the hard disk (all 76.53GB of it) - right ? but it appears as part of the "file system" - not as a separate hard disk (which is what I actually wanted).

What I was trying to achieve was /dev/sda exactly as I have it and /dev/sdb as a unique 76.53GB mounted drive where I can store data, not as a folder (!).

So, after all that explanation, here is my question:
How do I achieve what I want ? I know it's not a massive deal, but I'd rather not be storing my data half way down the files system tree !!

I thank you all in advance.

Jon

User avatar
xenopeek
Level 24
Level 24
Posts: 24525
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hard disk mistake

Post by xenopeek »

If you mount a partition on a hard disk (or a CD, DVD, USB, network share or whatever other storage device), it is mounted somewhere in your file system. You have only one file system on Linux (no exceptions), though different parts of it can be on different storage.

In your example you have chosen to mount /dev/sdb1 as /usr/local. Which means that any locally installed user software will be installed on /dev/sdb1 (which is a partition), and will be available at /usr/local (in the file system).

I wouldn't recommend storing data in /usr/local. It would be better to have done an installation where you had selected to mount /dev/sdb1, for example, as /mydata or something.

You can of course create a shortcut to the location in the file system where you have mounted the partition.
Image

AlbertP
Level 16
Level 16
Posts: 6714
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Hard disk mistake

Post by AlbertP »

When you mount a partition at a certain mount point, you have to move the files & folders to the new partition first. The folder /usr/local (or any other folder for that matter) will start pointing to the new partition. You don't see it, but this happens when you mount. The contents of the /usr/local folder on your root partition aren't visible anymore when another partition has become /usr/local.

As Vincent said, any partition which is not mounted inside /media or /home/<yourname> won't look like a seperate partition in file managers.

Do you really want to move all contents of /usr/local to another disk (for example as sda is full) or do you just need to store files on /dev/sdb?
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.

notwatson
Level 1
Level 1
Posts: 33
Joined: Mon Jan 09, 2012 3:22 pm

Re: Hard disk mistake

Post by notwatson »

Thanks for the replies.

I just want to store files on sdb.

Can I use GParted to reduce the size of the partition mounted at /usr/local and then use the remaining space for a partition mounted at (say) /mydata ?

TIA,

Jon

conslie
Level 4
Level 4
Posts: 366
Joined: Sun Oct 11, 2009 2:03 am

Re: Hard disk mistake

Post by conslie »

You will need to run gparted from a LiveCD/DVD to reduce the size of the existing partition on sdb.

However, unless you have some strong reason to have /user/local on a separate drive, you might want to just doing another install leaving all of sdb free for use as "mydata."

In either case, whether the whole drive or only most of it is used for your Data, what I have found useful is to create Pictures, Music, Videos, Documents and so on directories there, then create symlinks (right click - Make Link) to those directories, copy them to /home/yourname/, delete the empty Music and so on directories and rename the link file called "Link to Music" just "Music." Repeat for Downloads, Documents and anything else.

Hope this is clear enough.

Have fun!

User avatar
xenopeek
Level 24
Level 24
Posts: 24525
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hard disk mistake

Post by xenopeek »

I would do it easier. I would just copy the files in /usr/local to your /dev/sda5 partition.

1. Unmount the partition

Code: Select all

sudo umount /usr/local
2. Check that in /usr there is a local folder

Code: Select all

ls -ld /usr/local
Should reply similar to:
drwxr-xr-x 9 root root 4096 2011-12-13 22:03 /usr/local
If it doesn't, create the folder now:

Code: Select all

sudo mkdir /usr/local
sudo chmod 755 /usr/local
sudo chown root:root /usr/local
3. Remount the /dev/sdb1, on a different localation

Code: Select all

mkdir -p /mnt/local
sudo mount /dev/sdb1 /mnt/local
4. Copy all the files

Code: Select all

sudo cp -ap /mnt/local/* /usr/local
5. Edit fstab

Code: Select all

gksudo gedit /etc/fstab
And change the mount point on the line for /dev/sdb1 to something like /mydata, or where you want it to be.

6. Reboot
Check to see that all is in place, that you have a /usr/local populated with files, and that you have your /mydata

7. Delete the old files
Remove the files and folders on /mydata that you don't need anymore.

If you have any doubts about this, or are uncertain, please post. Until you complete step 5, a reboot will restore you to the previous situation.
Last edited by xenopeek on Wed Jan 25, 2012 10:04 am, edited 2 times in total.
Reason: Fixed two errors in commands
Image

notwatson
Level 1
Level 1
Posts: 33
Joined: Mon Jan 09, 2012 3:22 pm

Re: Hard disk mistake

Post by notwatson »

Many thanks Vincent.

I think you've understood exactly what I am aiming at.

I will give this a try and report back on my progress.

I'll add [fixed] to the title once I've sorted it all out. Watch this space....

Many, many thanks.

Jon

notwatson
Level 1
Level 1
Posts: 33
Joined: Mon Jan 09, 2012 3:22 pm

Re: Hard disk mistake

Post by notwatson »

Hi Vincent,

I've been stuck on work projects and have only just been able to turn back to this, so sorry for the late reply.

I've tried what you suggest.
At stage 1 ("sudo umount /dev/sdb1") the reply is:
"umount: /dev/sdb1: not mounted" ..... is this correct ?

When I type "ls -ld /usr/local" I do get the similar reply to your suggestion, so I assume there is a "local" folder in /usr

However, when I skip to your step 3, ("sudo mount /dev/sdb1 /mnt/local") I get the reply:
"mount: mount point /mnt/local does not exist"

So, what am I doing wrong here ?

Does this mean that sdb1 is not mounted ? (surely not....)
Do I have to create something else ?

Thanks for your continued help with this.

Jon

User avatar
xenopeek
Level 24
Level 24
Posts: 24525
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hard disk mistake

Post by xenopeek »

notwatson wrote:At stage 1 ("sudo umount /dev/sdb1") the reply is:
"umount: /dev/sdb1: not mounted" ..... is this correct ?
No, this is not correct. Please share the output of:

Code: Select all

cat /etc/mtab
notwatson wrote:However, when I skip to your step 3, ("sudo mount /dev/sdb1 /mnt/local") I get the reply:
"mount: mount point /mnt/local does not exist"
Sorry, I think between step 2 and 3 this command should be added (but it won't work until we figure out what goes wrong at step 1):

Code: Select all

sudo mkdir -p /mnt/local
Image

AlbertP
Level 16
Level 16
Posts: 6714
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Hard disk mistake

Post by AlbertP »

If you can't get it to work, you can also just not mount /dev/sdb at all, and use that partition by clicking it at the left, when saving or opening a file.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.

notwatson
Level 1
Level 1
Posts: 33
Joined: Mon Jan 09, 2012 3:22 pm

Re: Hard disk mistake

Post by notwatson »

Hi Vincent,

Thanks for the reply - here is the response to "cat /etc/mtab":

/dev/sda5 / ext4 rw,errors=remount-ro,commit=0 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
none /sys sysfs rw,noexec,nosuid,nodev 0 0
fusectl /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
none /dev devtmpfs rw,mode=0755 0 0
none /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
none /dev/shm tmpfs rw,nosuid,nodev 0 0
none /var/run tmpfs rw,nosuid,mode=0755 0 0
none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0
/dev/sda6 /home ext4 rw,commit=0 0 0
/dev/sdb1 /usr/local ext4 rw,commit=0 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0
gvfs-fuse-daemon /home/jon/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=jon 0 0

I hope you can make some sense of this.....

Cheers,

Jon

User avatar
xenopeek
Level 24
Level 24
Posts: 24525
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hard disk mistake

Post by xenopeek »

Okay, whoops... umount command should be:

Code: Select all

umount /usr/local
:roll: I corrected in above also, and double-checked the rest of the commands. This should be it. However, I'd appreciate it if you would do the following after step 3, post output here, before going to step 4 (and afterwards just reboot to reset to normal situation until it is checked everything is in place to start copying):

Code: Select all

ls -l /mnt/local
ls -l /usr/local
Image

notwatson
Level 1
Level 1
Posts: 33
Joined: Mon Jan 09, 2012 3:22 pm

Re: Hard disk mistake

Post by notwatson »

Thanks.

That change seems to have been successful.

Here is the output from those two commands:

ls -l /mnt/local gives:
total 48
drwxr-xr-x 2 root root 4096 2010-10-10 15:26 bin
drwxr-xr-x 2 root root 4096 2010-10-07 16:56 etc
drwxr-xr-x 2 root root 4096 2010-10-07 16:56 games
drwxr-xr-x 2 root root 4096 2010-10-07 16:56 include
drwxr-xr-x 3 root root 4096 2010-10-07 16:57 lib
drwx------ 2 root root 16384 2011-12-29 10:24 lost+found
lrwxrwxrwx 1 root root 9 2011-12-29 10:27 man -> share/man
drwxr-xr-x 2 root root 4096 2010-10-07 16:56 sbin
drwxr-xr-x 9 root root 4096 2010-10-10 15:29 share
drwxr-xr-x 2 root root 4096 2010-10-07 16:56 src

ls -l /usr/local gives:
total 0

Is it OK to move on to step 4 now ?

Thanks,

Jon

User avatar
xenopeek
Level 24
Level 24
Posts: 24525
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hard disk mistake

Post by xenopeek »

This is exactly as it should be! The /dev/sdb1 mounted on /mnt/local has all the folders that should be in /usr/local, and in /usr/local there are not yet any folders. So, go ahead an move everything. Note that I've edited the 4th command in above!

After the copy action, the output of:

Code: Select all

ls -l /usr/local
Should match the output of the "ls -l /mnt/local".
Image

Post Reply

Return to “Newbie Questions”