LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-07-2007, 10:03 AM   #1
Arituay
LQ Newbie
 
Registered: Sep 2007
Posts: 5

Rep: Reputation: 0
Moving a folder to a different partition


Hello all,
I just installed Ubuntu last night so I am complete newb at this. I had a plan for which folders I wanted on which specific partitions. I didn't end up achieving those planned results somehow during the install process. My /tmp folder in the partition with / but I want it on a different partition. How do I go about moving it?

A second question is how can a view a file explorer that shows the partitions as the highest level that can then be drilled into to see which folders are on them. The default file explorer just shows the various folders as the highest level. The only way I was able to figure out which folders were on each partition was to look at the folder properties and note which folders had the same amount of available disk space.

Thanks,

Arituay
 
Old 09-07-2007, 12:13 PM   #2
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
Go to /etc/fstab, 'file system table', and, as root, insert the appropriate line. It'll be easy to work out what this is by looking at your own or specimen fstab files. Perhaps something like:

/dev/hda7 ext3 /tmp blah, blah,....

Then $ mount /tmp, should do the job.

The partition hda7, say, must not have anything else mounted on it.

Incidentaly, try doing:
df -a
There may well be a temporary file system, don't know much about this, it'll perhaps be on RAM and not a disk.

You might also use a loop device to mount tmp. See info mount.

Hope helps.
 
Old 09-07-2007, 01:21 PM   #3
daMask
LQ Newbie
 
Registered: Jun 2007
Posts: 1

Rep: Reputation: 0
how to mount drives on boot up?

I also starting using Ubuntu recently. I am dual booting with windows xp, and I would like Ubuntu to mount my hard drives automatically on boot up. Is that possible?
 
Old 09-07-2007, 01:32 PM   #4
Freex
LQ Newbie
 
Registered: Oct 2006
Location: Belgium, Europe
Distribution: OpenSUSE 11.3 KDE, PCLinuxOS 2010 KDE
Posts: 29

Rep: Reputation: 17
Quote:
Originally Posted by daMask View Post
I also starting using Ubuntu recently. I am dual booting with windows xp, and I would like Ubuntu to mount my hard drives automatically on boot up. Is that possible?
Every file system mentioned in /etc/fstab is mounted automatically, so if you add the right line in there (as the root user) it should mount with the operating system.

Something like
/dev/sda1 /mnt/windows ntfs defaults 0 0

Replace '/dev/sda1' with whatever your windows partition is and '/mnt/windows' with your mountpoint
 
Old 09-07-2007, 02:19 PM   #5
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
daMask you should start your own post, that way more people will read it and try to answer. To answer your question you can have Ubuntu boot by default. You need to find the "grub menu list" and change the default from the windows to Ubuntu. You may also change the time for the wait. The Grub menu list is in your Ubuntu. There are multiple threads on this subject and a good tutorial on this site.
 
Old 09-08-2007, 08:05 AM   #6
Arituay
LQ Newbie
 
Registered: Sep 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lugoteehalt View Post
Go to /etc/fstab, 'file system table', and, as root, insert the appropriate line. It'll be easy to work out what this is by looking at your own or specimen fstab files. Perhaps something like:

/dev/hda7 ext3 /tmp blah, blah,....

Then $ mount /tmp, should do the job.

The partition hda7, say, must not have anything else mounted on it.

Incidentaly, try doing:
df -a
There may well be a temporary file system, don't know much about this, it'll perhaps be on RAM and not a disk.

You might also use a loop device to mount tmp. See info mount.

Hope helps.
Thanks for the help on this. Here is my fstab:

Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda2
UUID=9c6486a3-d30d-4e1e-bd40-5713aee4a1ef /               ext3    defaults,errors=remount-ro 0       1
# /dev/sdb1
UUID=764aba8f-20d5-41aa-9278-d6c741409f5e /home           ext3    defaults        0       2
# /dev/sda1
UUID=9CE49922E498FFA6 /media/sda1     ntfs    defaults,nls=utf8,umask=007,gid=46 0       1
# /dev/sda4
UUID=241a63ea-2275-47c0-9cf5-3395a5ff2975 /var            ext3    defaults        0       2
# /dev/sda3
UUID=5a5cfb64-9614-491a-93b8-4442b9003b0e none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/scd1       /media/cdrom1   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
Is there any way to move the /tmp folder to the sda4 partition?

Thanks again,

Arituay
 
Old 09-08-2007, 08:41 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Keep in mind that the data in a folder gets hidden if you mount a partition to that folder. Thus, you first have to copy the contents to some other temporary location.

Next, delete everything from /tmp (Presumably the reason for putting /tmp on a different partition was to save space)

Then setup the mounting in fstab (as already described), and mount sda4 to /tmp. Once this is done then anything written to /tmp goes into sda4

Finally copy the contents back into /tmp


NOTE: "moving a folder to a partition" does not give a good picture of what is happening..... Much better to say: "mount (connect) partitions to folders (AKA mountpoints)"
 
Old 09-08-2007, 11:18 AM   #8
Arituay
LQ Newbie
 
Registered: Sep 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Ok, I tried this and it moved the temp folder to the other partition. Unfortunately now my non-root user name was delete in the process.

I am stuck in root now. I create another user name via System->Administration->Users and Groups then close the Users and Groups window. Then I try to switch users and the new user name doesn't exist. I have created a new user, closed the user and group window, then reopen the user a group window and that user I just created is gone.

I have reverted back to the old fstab file and still newly created user names are still disappearing. What would be causing this?
 
Old 09-08-2007, 12:31 PM   #9
Arituay
LQ Newbie
 
Registered: Sep 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Resolved

Ok, I have resolved this by reinstalling Ubuntu, deleting all the partitions, then repartitioning the hds.

The moral of the story is that if you don't want a folder to end up on your / partition make sure to create a partition specifically for that folder in the installation process.

That is what I originally tried to do, but after I created four partitions on hda it said the remaining space was unusable. This time around I found out that there is a max of four primary partitions per disk. So I made the /var and /tmp partitions logical instead of primary in the new partition screen and that successfully allowed me to have 5 partitions on hda.

Thanks for the advice all.

Arituay
 
Old 09-08-2007, 12:41 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
we all win when someone has successes like this--glad to see you getting things working.
 
Old 09-08-2007, 01:02 PM   #11
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
I don't know what went wrong but I have moved directories quite a few times in the past. There are a few precautions to take but other than that it should work fine. Fedora is a bit of a special case with its Selinux but Ubuntu shouldn't create any issues at all. I assume that the tmp directory wasn't properly copied over.
 
Old 09-08-2007, 01:53 PM   #12
Arituay
LQ Newbie
 
Registered: Sep 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jay73 View Post
I don't know what went wrong but I have moved directories quite a few times in the past. There are a few precautions to take but other than that it should work fine. Fedora is a bit of a special case with its Selinux but Ubuntu shouldn't create any issues at all. I assume that the tmp directory wasn't properly copied over.
That is possible, though I don't know where I went wrong. These are the steps I took (as root):

1. copied the files in tmp into a separate folder in /home
2. deleted the files in tmp
3. saved a backup fstab file
4. edited the original fstab file by adding a line for /tmp (using the same UUID as the /var line because from what I could tell I had to do that to have the /var and /tmp folders on the same partition)
5. saved the changes to fstab
6. ran the terminal
7. entered command: mount /tmp
8. moved the copied tmp files from the temporary folder in /home into /tmp (strangely there were already folders in the newly mounted /tmp folder before I moved the old tmp files back even though I had deleted the files from /tmp before changing fstab).
8. logged out (at this point my screen just stayed black for a few minutes, at which point I shut off my PC)
9. tried to log in to my main user account and it was gone, could only log in as root, all attempts at creating a new user account appeared to succeed but then the accounts wouldn't work

Any pointers on what I did wrong?

Thanks again,

Arituay
 
Old 09-08-2007, 06:33 PM   #13
cojo
Member
 
Registered: Feb 2003
Location: St. Louis
Distribution: RedHat 8
Posts: 262

Rep: Reputation: 31
Arituay,

what you should have done is create another partition for /tmp and leave /var alone. Because, /var mount point contain many other system files. So, when you mount /tmp on the same partition as /var you hide all the file in /var which cause your problem. Also, there shouldn't be anything need to be save on /tmp anyway. Unless, you save stuffs in the /tmp which is very bad thing to do. BTW, there is also a tmp directory in /var/tmp. As for why you can only log in as root is because root home directory is /root and not relate to any other mount point.
 
Old 09-08-2007, 06:59 PM   #14
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Exactly. The proper procedure is like this:
- prepare a new partition
- reboot into single user mode
- create a new directory for the new partition: mkdir /new
- copy the files from /tmp to the new partition: cd /tmp && cp -ax * /new
- rename your old /tmp to, say, /oldtmp: mv /tmp /oldtmp
- make a new tmp: mkdir /tmp
- create the proper permissions: chmod 1777 /tmp
- unmount the new partition: umount /new
- remount the new partition under /tmp: mount /dev/??? /tmp
- delete the /new directory
- edit /etc/fstab to include the new partition
- reboot
 
1 members found this post helpful.
  


Reply

Tags
folder, installation, partition, unusable



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving my home folder. Lordandmaker Linux - Newbie 2 01-29-2006 02:08 PM
moving files from windows partition to linux partition M O L8ingN2dust Linux - Newbie 11 01-08-2006 09:11 PM
Cursor problems when moving a Folder Riddick Linux - Software 0 08-27-2005 04:03 PM
Moving home folder under Knoppix Lemop Linux - Newbie 1 01-22-2005 02:29 PM
moving a file to a folder gets error jackstoage Linux - Newbie 3 04-02-2004 10:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration