LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to reallocate space between partitions/devices ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-reallocate-space-between-partitions-devices-707780/)

foampile 02-26-2009 01:08 PM

how to reallocate space between partitions/devices ?
 
this is what my 'df -h' says

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2.0G 2.0G 0 100% /
none 851M 0 851M 0% /dev/shm
/dev/sda2 147G 188M 140G 1% /mnt


i would like to move some space from sda2 to sda1. is there a way to do it ?

thanks.

frieza 02-26-2009 01:16 PM

sure, however just a question, you have a drive mounted as /mnt ?
i wouldn't recommend that as /mnt is a directory for creating mount points but isn't intended to be a mount point itself, yes you can mount a volume as /mnt as you already have, any directory with the exception of /root can be a mount point but that doesnt mean it should be one, i would create a directory under /mnt such as /mnt/something and edit the /etc/fstab to point /dev/sda2 to /mnt/something instead
note, /root (user root's home directory) is an exception as it has to be on the same partition as the system in case you have to boot without the other partitions mounted you can gather utilities in root's home to use to restore functionality and you can't do that if /root is a separate partition

replacing something with a name that is descriptive of what you put there

for instance if you have alot of music, you could mount it as /mnt/music and move your music files there
or alot of music and video make it /mnt/media and put your music and video files there
or for just plain files /mnt/storage and put your files there
etc...

after that it is just a matter of locating files you want to put there and using your favorite file manager to move them there or at a prompt, mv - *files* /mnt/something/

that should free up space

foampile 02-26-2009 01:31 PM

it's like that because i didn't really configure it all myself. this is an instance of an image from Amazon Elastic Compute Cloud.

pixellany 02-26-2009 02:07 PM

Quote:

Originally Posted by foampile (Post 3458455)
it's like that because i didn't really configure it all myself. this is an instance of an image from Amazon Elastic Compute Cloud.

Just a bit more detail is going to be needed here......;)

Please describe the overall situation and what you are trying to do. As part of this, tell us what your hardware is--hard disk, RAM, etc.---and how and why you are installing this image.

Also, I doubt that I am the only one who does not know what is the "Amazon Elastic Compute Cloud".

frieza 02-26-2009 02:11 PM

either way, it may be just as easy as moving a few files into the directory that the other partition is mounted as and use them from there ;)
always try the most conservative approach first ;)

foampile 02-26-2009 03:29 PM

Quote:

Originally Posted by pixellany (Post 3458501)
Also, I doubt that I am the only one who does not know what is the "Amazon Elastic Compute Cloud".

http://aws.amazon.com/ec2/

foampile 02-26-2009 03:43 PM

dudes, i don't have anything under /mnt except for lost+found, i just need the command to reallocate the space.

pixellany 02-26-2009 03:44 PM

Quote:

Originally Posted by foampile (Post 3458621)

Very interesting, but it does not answer my other questions.....

foampile 02-26-2009 04:38 PM

Quote:

Originally Posted by pixellany (Post 3458639)
Very interesting, but it does not answer my other questions.....

since it is a server hosted somewhere else, i guess i don't have access to that kind of info. the OS is Fedora 9.

frieza 02-26-2009 04:42 PM

Quote:

Originally Posted by foampile (Post 3458634)
dudes, i don't have anything under /mnt except for lost+found, i just need the command to reallocate the space.

all you have to do is move files into that directory, the rest takes care of itself


open a file manager such as nautilus or konqueror with 2 windows
navigate one window to /mnt
navigate another window to a directory where you keep say.. your music or videos
move the files, it's a simple cut/paste operation in a gui file manager
it's that simple
or if you prefer command line
cd to a directory that contains files such as music and mv them to /mnt

foampile 02-26-2009 04:45 PM

dude, there is no files involved. it is like reallocating partition space.

frieza 02-26-2009 04:49 PM

how are there no files involved?

files occupy space on a volume if a volume is full you can't put more files

/mnt is simply a pointer to a separate volume which is empty

in windows it would be the equivilent of a separate drive letter (e.g. d: )

moving files such as music or media files (which occupy space on your volume) to /mnt will unallocate the space they occupy on that volume and reallocate them to the other volume

nothing more or less to it

foampile 02-26-2009 04:54 PM

i know but in windows you would have to repartition the disk to redistribute space between different drives. if c: has 8G and is full and d: has 20 and is half empty, you need to repartition to give some of d's space to c. it is not as simple as copying files.

frieza 02-26-2009 05:01 PM

ok, that's a little more descriptive of what you want ;)
first backup your files in case something goes wrong
then use gparted to edit your partitions
however since your / volume is full you will still have to move files off of it first to make room for installing gparted if it isnt already installed
you can also try a live cd distribution that comes with gparted such as backtrack

jschiwal 02-26-2009 05:22 PM

You mentioned this is to be used as a server. What kind of server?

What is the purpose of /dev/sda2? You could copy all of the files from /usr or /var (e.g. sudo cp -aR /var/* /mnt/ ) and when it is finished, delete the files in /usr; umount /mnt and mount /dev/sda2 on the /usr/ directory instead.
In this way Linux is different than windows. All of the partitions are mounted on a directory. There is only one root directory (/) that contains the mountpoints. E.G. mounting a partition on /home, or on /mnt/disk/. By moving the files in /usr, you are freeing up space. By mounting /dev/sda2 on /usr, the files will appear to be the same place they were before the changes. But they exist on another filesystem on /dev/sda2.

For a server, there may be a large /var/srv or /var/www directory. If that is the case, copying the data from /var/ might be a better idea.

---
2 GB is not very much at all. A program like gparted can resize partitions, but you will need to do it from a live distro.
Are you sure you aren't in the install environment? Is this a remote server running in a VM? For a desktop system, Fedora will by default create a /boot, swap and an LVM2 partition.

For a server, you want /tmp, /var and if it exists /srv on separate partitions, or at least not a part of root. Someone could easily file up /var/log/ with logs. This will cause fewer problems if the logs aren't in their own partition.

The /usr/ partition tends to be very large. For a workstation or a server with regular users, /home will be the largest partition. /usr will be the second largest and grow slowly with time as you add more software. For a general purpose file server, perhaps /var/samba will be the largest. For a web server, /var/http.

The /bin/, /sbin/, /etc directories won't contain as much and for a server, you won't install much software anyway. These can stay on the root (/) directory.


All times are GMT -5. The time now is 02:00 PM.