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 - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 09-19-2006, 07:54 PM   #1
Jukas
Member
 
Registered: Mar 2005
Posts: 141

Rep: Reputation: 15
resizing existing partitions?


I have a Debian machine with a 250gb hdd in it that I really need to resize the partition on an active ext3 filesystem.

Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.6G  932M  3.5G  21% /
tmpfs                1010M     0 1010M   0% /dev/shm
/dev/hda9             102G  129M   97G   1% /backup
/dev/hda8              92G  129M   87G   1% /home
/dev/hda7             669M   17M  618M   3% /tmp
/dev/hda5              14G  1.1G   12G   9% /usr
/dev/hda6              14G  566M   13G   5% /var
tmpfs                  10M   52K   10M   1% /dev
This box is now going to be used as a mail server, which means it's goign to generate a lot of logs. I need to take some of the space from either the hda8 or hda9 partition and increase the size of the hda6 partion.

Is it possible to do this without having to reinstall the entire server from scratch?
 
Old 09-19-2006, 08:50 PM   #2
luis14
Member
 
Registered: Jun 2006
Location: Des Moines
Distribution: Debian Lenny
Posts: 59

Rep: Reputation: 15
I have used gparted live cd and qparted in the kanotix live cd to resize partitions. Both work well and allow you to view changes graphically before commiting. If I understand your partition scheme I believe you could delete hda7, shrink hda8, and in the freed up space make a new hda7 and grow hda6 to fill the balance.

Last edited by luis14; 09-19-2006 at 08:54 PM.
 
Old 09-20-2006, 02:43 PM   #3
basileus
Member
 
Registered: Nov 2004
Location: Turku, Finland
Distribution: Debian, Ubuntu, Gentoo
Posts: 388

Rep: Reputation: 30
I usually do resize partitions on the fly like this (there might be typos in here, please use common sense

Copy the data to another partition: "cp -a /var /usr/var". Note that the -a switch is mandatory, otherwise you'll screw up everything

Unmount the partition (umount /var)

Remove the old mountpoint (rm -rf /var)

Link the new location to the old mountpoint (ln -s /usr/var /var): this way system does not even know that /var was gone.

Do the necessary resizing of the (unused) partition with "cfdisk", "fdisk" or whatever.

Mount the newly created partition to some other directory (mkdir /newvar;mount -t ext3 /dev/hdaX /newvar)

Copy the data to the new partition (cp -a /usr/var/* /newvar)

Unmount the new partition (umount /newvar)

Remove the symbolic link (rm /var)

Rename the new partition (mv /newvar /var)

Edit /etc/fstab and mount the new partition (mount /var)


Gosh... that seems quite complicated . But I've moved all my partitions once or twice in above manner and I haven't experienced any problems so far. Actually once you get the idea this procedure is rather easy, even though by no means a perfect solution.

If you can, resize the partion on the fly without all this fuss. Just take backups with the "cp -a" first, just in case.
 
Old 09-20-2006, 11:11 PM   #4
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
I've used similar process as above and currently I'm using the lvm-partitions as they make the process nice and easy
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running out of space - resizing my existing Linux partition gljubuncic Linux - Software 7 07-01-2006 09:48 PM
resizing existing partition rahilrai SUSE / openSUSE 2 03-15-2006 09:55 AM
Possible to create new partition by resizing existing? rollo SUSE / openSUSE 11 07-02-2005 08:31 AM
Resizing an existing RH9 Linux partition Battletux Linux - Newbie 1 05-27-2004 07:59 AM
Resizing Existing Linux Partition (ext3) BxBoy Linux - General 23 09-22-2003 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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