LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-11-2002, 05:20 AM   #1
tommygunner
LQ Newbie
 
Registered: Jul 2002
Posts: 3

Rep: Reputation: 0
Angry Adding partition


I already have Linux installed and running and want to add a partion for /var because I store lots of files there. Does anyone know how to do this without re-installing?

My other options are to store large files in /home directory and point Apache there.

Another option that I think is possible is creating symbolic link from /var directory to /home.

I only know how to do second thing. The rest I don't know how to do. Can someone help me? I am using Mandrake Linux 8.2
 
Old 07-11-2002, 05:51 AM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You can use parted to resize a partition. From the free space create a new partion - for /var. Mount it, copy all data. Then you need to modify fstab to add your /var partition there. When it's done delete old /var and test it.
NOTE: It's a good idea to make backup copies.
 
Old 07-11-2002, 05:52 AM   #3
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well if you've got the partition already created all you have to do is change a few things to get it to mount.

Add a line something like this to the file /etc/fstab:
/dev/hda7 /var ext2 defaults 1 1

Make sure it's formated for the particular filesystem, ex. 'mke2fs /dev/hda7'

Then you should create a new entry for /var:
mv /var /oldvar
mkdir /var

Then mount it:
mount /var

Then copy all the old stuff to the new var directory:
cp -a /oldvar/* /var


If you want to have the files on the /home partition then you would do something like this:

mkdir /home/othervar
cp -a /var/* /home/othervar
rm -rf /var
ln -sf /home/othervar /var
 
Old 07-11-2002, 06:05 AM   #4
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
parted,... huh?!?!? Never used it. Mandrake 8.2 has a nice utility to move partitions around.

If you are using Mandrake 8.2, I would use diskdrake. It has a nice, easy-to-use GUI front end.

If the partition is already created, you simply make it's mount point as /var and copy all of your /var directory files there. Diskdrake might do it for you automatically, but have a back-up.

If you don't have the partition created,...

Copy all the files to a partition that is not going to be volitile. For instance, if you have a large /home partition,but not much there now, you can back up all the files to some other partition (either the root partition if large enough or a windoze FAT partition if large enough). Then unmount and resize the partitions using diskdrake. format them and create their appropriate mount points (i.e.: /var, /usr). Then copy your data back to the appropriate partitions. If you are doing this for the /home partition, make sure you reset the permissions to the users who's accounts they are. Moving them will often change them to ownership by root. You have to make their owners and groups back what they were.
 
Old 07-11-2002, 06:14 AM   #5
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
By the way, tommygunner, are you aware of the Mandrake User Forum boards???

Check here, you can post the same request there for different/better answers:
http://www.club-nihil.net/mub/
 
Old 07-11-2002, 06:20 AM   #6
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Moving the files will not change the owner. This only happens when you do a copy. Buy you can prevent that by using the -p switch which will preserve the owner and group (-a is equivalent to -dpR so you don't have to add a -p to that).
 
Old 07-11-2002, 08:38 AM   #7
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
Trying to copy large segments of files complete with parsing over subdirectories with the command line is a pain. I just use konqueror.

Whe I do it often resets the ownership. So I just use it to set it back. It's still faster than moving them over with the command line interface.

Command line is great for some things, but just not for moving things around quickly. GUI is more intuitive and faster for that.
 
Old 07-11-2002, 08:43 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
no, you should always use command line for moving large amoutns of files aruond for partitions etc. if you know whow to use it it will be a much more reliable and safer option, free from risking breaking symlinks or changing ownershpis and such. using konqueror seems very dangerous to me.

normallly i use a combination of find and cpio..

find -xdev /some/where/ | cpio -pvd /destination

preserves everything perfectly. no risk.
 
Old 07-11-2002, 09:58 AM   #9
RefriedBean
Member
 
Registered: Jun 2002
Location: N 37° 33.327 E 126° 55.650
Distribution: Gentoo, Slackware, OpenZaurus
Posts: 186

Rep: Reputation: 31
Quote:
Originally posted by JaseP
[B(either the root partition if large enough or a windoze FAT partition if large enough).[/B]
It might not be such a good idea to copy them over to a FAT partition. The reason being that FAT has no concept of the things like file ownership etc. that unix has. If you do that, all the files will lose their permissions etc, and you might be in for a nasty suprise.

Correct me if I'm wrong

GoodLuck!
RefriedBean
 
Old 07-11-2002, 02:36 PM   #10
tommygunner
LQ Newbie
 
Registered: Jul 2002
Posts: 3

Original Poster
Rep: Reputation: 0
If I want to copy my entire hard drive to backup drive, what command would I need to issue?
 
Old 07-11-2002, 02:41 PM   #11
tommygunner
LQ Newbie
 
Registered: Jul 2002
Posts: 3

Original Poster
Rep: Reputation: 0
When adding /var partition, where is it picking up space from? It has to take space from another partition. My /home partition is largest.
 
Old 07-11-2002, 04:06 PM   #12
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
tommygunner,

You should copy one partition at a time.

Diskdrake will allow you to reformat one partition at a time, even breaking it into smaller partitions, but it is a destructive process, so you need to have that data backed up somewhere.

As for backing up to a FAT drive, that's why I mentioned that a FAT drive may over-write your permission settings. However, konqueror allows you to re-set them once the data is back in it's own partition by (a) enable hidden file view, and (b) right click on the directory and change its permissions, making sure to check the box indicating that you want the changes to be globally applied to all subdirectories and their contents.

It's not a real problem when moving user data around.

Once you create a /home and a /var out of the present /home partition,...
diskdrake will ask if you want to transfer the data from the /var directory into the newly created /var partition. You say yes and it begins the format procedure followed by the file transfer.

Then you reset the /home partition the same way, and move the data from wherever you backed up the /home data to back to the newly resized /home partition. Make sure permissions are right, and whalla,... your system is now the way you want it.

If you prefer, back up the /home directory with the command line references the others indicated and do it to a Linux partition rather than a FAT one. I suggested using a FAT partition because most people have a spare FAT partition mounted on their Linux systems (either as their duel boot partition or as a secondary hard drive within both Linux and Windoze).
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a new partition to an existing LV ntwrkguru Fedora 9 11-03-2005 08:22 AM
Adding a new partition paul_dundee Linux - General 3 03-25-2005 05:51 PM
Adding a partition eddydw General 2 01-25-2005 01:43 PM
Adding a partition in RedHat 9 PionexUser Linux - General 8 09-04-2003 05:25 AM
Adding a new linux partition!!! Hachaso Linux - Software 4 03-31-2002 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:38 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