LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 06-30-2004, 03:12 AM   #1
wolfpeach
LQ Newbie
 
Registered: Jun 2004
Location: Oxford, UK
Distribution: Debian
Posts: 27

Rep: Reputation: 16
Post installation re-partitioning: how to move /var?


I've have a file & print server running Debian woody on a 500mb partition (uses just over 2/3 of it), but had not realised that /var could fluctuate so much, & dont want it to clog the disk. I''d rather keep the partition small so that I can easily reinstall from backup if need be. I've read* that its good practice to keep certain directories on different partitions, and have all the /home directories on a separate disk, but unsure how to move /var now that all is set up.

Is it just a case of repartitioning some empty space on the disk (say with cfdisk) and editing /etc/fstab to point to it? Do I need to manually shift stuff over? Is there anything else I would need to edit to make sure that the system knew that the location had changed? I know that this is a case of 'I wouldnt start frm there...' but I would really rather not reinstall all over again... again. ;-]

*
http://www.debian.org/doc/manuals/se...3.en.html#s3.2
http://wwwcmc.pharm.uu.nl/gillies/debian/

All the best,
Wolfpeach
 
Old 06-30-2004, 03:25 AM   #2
Thoreau
Senior Member
 
Registered: May 2003
Location: /var/log/cabin
Distribution: All
Posts: 1,167

Rep: Reputation: 45
Something that may help you in debian is qparted which allows moves in some cases.

http://ftp.gnu.org/gnu/parted/

Much like partition magic. What you can do backup your var data to a removable media or the like, rm -rf your /var partition, add the new drive with the /var partition formatted and mount. Qparted will assist with this. cfdisk can do it as well, but I think it sucks- YMMV.

It's not as bad as it seems. You just need to get your data off both drives to make sure it isn't lost. Or if you're a gunslinger, you can just copy it over to another directory like /root/ohcrap. Have fun.

Thor
 
Old 06-30-2004, 04:23 AM   #3
wolfpeach
LQ Newbie
 
Registered: Jun 2004
Location: Oxford, UK
Distribution: Debian
Posts: 27

Original Poster
Rep: Reputation: 16
Thanks Thor!

Have copied /var over to another partition (hda3), and am editing fstab to mount it at boot & point to it... just wondering what the mount point should be given as...

Its currently copied over as /var, so should the mount point be / or /var? (ie, keep an empty /var directory on hda1, and copy over just the contents of /var to hda3... ) agghhh.... getting confused here!

btw, Gnuparted looks fun, will give it a spin sometime.
 
Old 06-30-2004, 09:35 AM   #4
wolfpeach
LQ Newbie
 
Registered: Jun 2004
Location: Oxford, UK
Distribution: Debian
Posts: 27

Original Poster
Rep: Reputation: 16
OK - sorted now (minus a few fingernails tho! - thank god for the backup I took with tar last week!)

Heres how:

1) make the new partition, & format with mkfs. (in my case hda3)

2) mount the new filesystem in /mnt

# mkdir /mnt/new
# mount /dev/hda3 /mnt/new

3) Go to single-user mode so that there is no rw activity on the directory during the process (could be messy...)

# init 1

(re-enter root password - wont work via ssh... gave me a shock!!)

4) Backup data in var only (not the /var directory itself)

# cd /var
# cp -ax * /mnt/new

5) Rename the /var directory (to make sure this has worked before deleting it!)

# cd /
# mv var var.old

6) Make new var directory

# mkdir var

7) Unmount the new partition

# umount /dev/hda3

8) Remount it as /var

# mount /dev/hda3 /var

9) Edit /etc/fstab to include the new partition, with /var given as the mount point, so that it will be included in the filetree automatically at boot.

& when y'r sure that alls well, delete var.old...

Bingo.

 
1 members found this post helpful.
Old 06-30-2004, 10:17 AM   #5
sterrenkijker
Member
 
Registered: Mar 2004
Location: the Netherlands
Distribution: Debian Sarge
Posts: 302

Rep: Reputation: 30
hey, nice, thanks for the explanation!

I wanted to free up some diskspace of my rootpartition too, and had an empty 150 MB partition around. Just enough for the javasdk . Worked perfectly, as it is nothing system-critical and all javastuff is in one directory.

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Can I move a post to a different forum? BCarey LQ Suggestions & Feedback 1 11-01-2005 12:03 PM
Post-Install Partitioning - Dual Hard Drives dolvmin Linux - Hardware 16 08-12-2005 11:05 AM
how to move data in partitioning provkitir Linux - Software 1 11-07-2004 06:21 PM
partitioning a new drive, which directories can I move ? xucaen Linux - General 2 02-25-2004 09:03 PM
/var move killed ftp server jeffpoulsen Linux - Networking 1 10-24-2002 07:46 AM


All times are GMT -5. The time now is 05:11 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration