LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-24-2008, 01:53 AM   #1
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Rep: Reputation: 15
Ubuntu8.1 partition problem..


Dear all,

I have a 250gb, seagate sata disk. I have dedicated 25gb to ubuntu. While partitioning for ubuntu mistakenly i gave only 600mb of space to /var partition. Now when i am going to install a new software the system is not letting me to install by giving an error message like "Not enough disk pace, cannot continue the installation" or "not enough space in /var".

Can i repartition the /var partition giving more space. Acually i hav /usr3 partition of 1.3gb. I dont need this can i merge /var and /usr3 as /var? Then i can get more space for /var Guide me..thank you in advance

The following is my df

Size Used Avail Use% Mounted on
/dev/sda14 9.2G 2.0G 6.8G 23% /
tmpfs 243M 0 243M 0% /lib/init/rw
varrun 243M 104K 243M 1% /var/run
varlock 243M 0 243M 0% /var/lock
udev 243M 2.8M 241M 2% /dev
tmpfs 243M 332K 243M 1% /dev/shm
lrm 243M 2.0M 241M 1% /lib/modules/2.6.27-7-generic/volatile
/dev/sda9 183M 18M 156M 11% /boot
/dev/sda10 5.5G 897M 4.4G 17% /home
/dev/sda11 5.5G 170M 5.1G 4% /usr1

/dev/sda15 1.5G 35M 1.3G 3% /usr3
/dev/sda12 373M 217M 137M 62% /var

varun@varun-desktop:~$

Last edited by visitnag; 12-24-2008 at 02:03 AM.
 
Old 12-24-2008, 02:51 AM   #2
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi,

No you can't add '/var' to '/usr' because they are on the same 'level'.

What you can do though is use '/'!

You assigned 9.2GB to / which is huge but good for your situation.

/dev/sda14 9.2G 2.0G 6.8G 23% /

you need to copy (use rsync) your /dev/sda12:/var to a new /dev/sda14:/var

I'd boot from a liveCD and do the following:

# mkdir /mnt/{old_var,new_var}
# mount /dev/sda12 /mnt/old_var
# mount /dev/sda14 /mnt/new_var

# rsync -av /mnt/old_var/ /mnt/new_var/var/

Disable the /var mounted partition from ftab
# vi /mnt/new_var/etc/fstab

unmount both partitions, reboot.

Check before executing, I did this from the top of my head...

Hope this helps.

Last edited by eco; 12-26-2008 at 04:08 AM.
 
Old 12-25-2008, 12:58 AM   #3
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
Thank you eco!

But i am new to the ubuntu and i know very little of shell commands. I am good at using the regular commands like cut,paste,join etc. I dont know the usage of mounting commands. I am confused at new_var, rsync and mkdir /mnt{old_var,new_var} command. I have live ubuntu8.1DVD. Can you please giv me the command list according to my system requirements to increase /var partition?
 
Old 12-26-2008, 04:07 AM   #4
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi visitnag and merry x-mas,

mkdir will create a dir
rsync is a powerful way to copy files.
mount allows you to mount a partition to a location. You must understand how Unix mounts partitions, it's very important.

The idea is to move your '/var data' to your '/' directory.

Considering that:
/dev/sda14 holds /
/dev/sda12 holds /var

We boot from a liveCD to work on the OS without it running.

Now that you are in the 'LiveCD OS' You can mount both partitions to temporary directories.

create 2 dirs
# mkdir /mnt/old_var
# mkdir /mnt/new_var

mount /var to old_var
# mount /dev/sda12 /mnt/old_var
mount / to new_var
# mount /dev/sda14 /mnt/new_var

Now you copy all the data from '/var' to '/' (old_var -> new_var).
# rsync -av /mnt/old_var/ /mnt/new_var/var/

rsync will make sure you copy hidden files, etc. do *not* forget the trailing slashes.

now your '/' contains a dir 'var' the data from old '/var'... make sence?

Now you simply edit fstab to not mount your old '/dev/sda12 /var'.

Now unmount both partitions and reboot after saving the changes.

If you need more help, let me know. Remember that you can always type" man <command> to get more info on a command (man rsync for example).

Last edited by eco; 12-26-2008 at 04:09 AM.
 
Old 12-26-2008, 06:05 AM   #5
arckane
Member
 
Registered: Sep 2005
Location: UK
Distribution: Gentoo/Debian/Ubuntu
Posts: 308

Rep: Reputation: 39
Hmm, another option which is graphical would be to boot off of the Ubuntu live disk and then use GParted to resize the partitions.

I would however try to learn the command line, it's well worth doing.
 
Old 12-26-2008, 02:06 PM   #6
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi arckane,

I didn't know about that one but if he does use it, he should probably do a proper backup first.

He'd also have to shrink a partition and extend another so it looks a little risky to me.

visitnag, have you managed to do any of this?
 
Old 12-31-2008, 12:34 PM   #7
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
Thank you lot for all your support.... I am not in station...on the tour to enjoy the year end. I will try this in the new year. I wish you all Happy New Year.
 
Old 12-31-2008, 08:10 PM   #8
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
as akckane said it is really challenging to use command line.

The following is my fstab /var entry... how to edit this to not mount..and let me know the new /var (which is /mnt/new_var/) is to be mounted or not?

# /dev/sda12
UUID=0e49f8c1-1149-41e3-92e8-ec06a8d1fe5f /var ext3 relatime 0 2
# /dev/sda13
UUID=ec7d594a-e17c-4bac-90f5-6dd9e5b05172 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
 
Old 01-01-2009, 01:54 AM   #9
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Mint, MX, antiX, SystemRescue
Posts: 2,337

Rep: Reputation: 358Reputation: 358Reputation: 358Reputation: 358
You said you don't need /usr3. So wipe out all the data there:

(1) sudo rm -rf /usr3/*

Note: The above command is simple enough, but a single extra space typo'ed in between the slash and the asterick will really screw you! It is probably better to do it this way to be safe:

(1a) cd /usr3
(1b) pwd (verify that you are REALLY in /usr3)
(1c) pwd (yes, verify that you are really in /usr3 a SECOND TIME)
(1d) sudo rm -rf *

Next, clean up uneeded stuff currently under /var

(2) sudo apt-get clean
(3) rm -rf /var/tmp/*

Note: ... or ... for safety from typos, do the remove like (1a) - (1d) above

Next, copy /var to /usr3

(4) sudo cp -r /var/* /usr3/.

Note: Watch them spaces again! I keep pointing this out to you because you said you weren't terribly good with the command line. It's powerful. So powerful in fact, that you can nuke yourself in short order with a simple typo.

Next, unmount /var and /usr3

(5) umount /var
(6) umount /usr3

Note: You may have trouble unmounting /var on a running system because processes may be holding files open there. If you can't identify and nuke these processes (use "lsof /var" to find them), you may have to do this filesystem switch-a-roo using a LiveCD.

Next, mount the OLD /usr3 as /var, and the OLD /var as /usr3

(7) mount /dev/sda15 /var
(8) mount /dev/sda12 /usr3

Next, edit /etc/fstab to permanently switch the /usr3 and /var mountpoints

(9) sudo vi /etc/fstab (make appropriate changes)

Note: You need to research and learn what these fstab changes are yourself, so you know what you are doing before you start editing. They're simple, but if you mess them up you might end up with a non-bootable system. This is why you make backup copies of important files before editing AND always have a LiveCD handy that you can boot from to fix errors. I recommend SystemRescueCD.

Next, learn about LVM ("Logical Volume Management") so you can avoid these hard-partition problems in the future.

(10) Google -> "LVM Howto"
 
Old 01-01-2009, 05:35 AM   #10
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
I am trying to understand the fstab and will edit. As everybody installs third party softwares, What would be the ideal size of a /var partition?
 
Old 01-02-2009, 10:38 AM   #11
centguy
Member
 
Registered: Feb 2008
Posts: 635
Blog Entries: 1

Rep: Reputation: 48
Don't know about others, I still prefer to just define / for
my linux system (of course, a separate SWAP partition to be shared
by all other linux distros). I don't want to be bothered by how much to give for /var, /home.. (the partition table will look very messy, not really ideal for multiboot). Actually I find migrating would be easier if I have everything under one roof, but well, that's just me.
 
Old 01-04-2009, 06:11 AM   #12
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
Damage was done!!!

Sorry friends(especially eco and haetig).... i could follow to create folders...unmounting the /var and /usr3 but unable to edit my fstab. Then i did following experiments without any experiance(lol)

1. Using gparted i deleted /usr3 and using later using live cd of gparted i deleted /var also(ofcourse the /var contents i copied into some other directory).

2. Then i tried to create a new /var using gparted....when i selected <new> option in gparted i could not found any mount point option in it(i could only create a logical partition as /dev/sda)

3 Then i tried to boot into ubuntu......thats...all..... it failed to boot...it went into cli mode....by telling that there is know /var partition. Here i failed to repair it.

4 After then i loaded ubuntu again. Here i created partitions like this on 25gb space located to ubuntu

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda9 9614116 2244516 6881228 25% /
tmpfs 248612 0 248612 0% /lib/init/rw
varrun 248612 108 248504 1% /var/run
varlock 248612 0 248612 0% /var/lock
udev 248612 2820 245792 2% /dev
tmpfs 248612 356 248256 1% /dev/shm
lrm 248612 2000 246612 1% /lib/modules/2.6.27-7-generic/volatile
/dev/sda10 186663 17796 159230 11% /boot
/dev/sda11 5763616 1144124 4326712 21% /home
/dev/sda12 474440 10572 439371 3% /tmp
/dev/sda13 5763616 142652 5328184 3% /usr1
/dev/sda15 1375616 237652 1068084 19% /var

Here i did not select / partition to be formatted. So luckily i got back all my data which are saved in /home/varun, but i lost the installed 3rd party softwares(like mysql, php, vim-full, gawk3.1.6 etc.,)

NOW I AM FACING ONE MORE PROBLEM. Here i started to install the above softwares thru apt-get command, but the system is not letting me to do so....the following is the error..at command line..

root@varun-varsha:/home/varun# sudo apt-get install mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package mysql

root@varun-varsha:/home/varun# apt-get install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package php5

Can anybody solve my problem. Thank you in advance.
 
Old 01-04-2009, 12:55 PM   #13
grndrush
LQ Newbie
 
Registered: Jan 2004
Location: Hamilton, Ontario, Canada
Distribution: Arch
Posts: 17

Rep: Reputation: 0
Well, I can't *solve* your problem - but I can hopefully help YOU to solve it!

You do NOT need to reinstall all your software! It's all there - the problem is the ubuntu file or database (I'm ubuntu-ignorant) which tells the system about those installed packages, is (well, *was*...) on /var.

IF I correctly understand all you've done, you're 5 minutes from home. Boot using your live CD, then:

# mkdir /mnt/old_var
# mkdir /mnt/new_var
# mount /dev/sda10 /mnt/old_var
# mount /dev/sda14 /mnt/new_var
# rsync -av /mnt/old_var/varun/ /mnt/new_var/var/
# vi /mnt/new_var/etc/fstab # disable former /var (see below)
# umount /dev/sda14
# umount /dev/sda10
# reboot

The umount's should work just fine - you're running from the CD, not from the hard drive.

If you didn't figure out how to disable /var in fstab, you simply need to put a "#" at the start of the line containing the /var entry - or simply delete the entire line; either works. Linux geeks consider the former way (commenting out the line) to be "safer" - if you need any of the parameters later, the line is still there.

HTH...and this was also off the top of my head; basically it's just finishing what eco and the others were having you do. This just picks up where you ran into problems earlier (and be VERY glad you backed up /var! ).

FWIW:

1. If/when you DO reinstall, take centguy's advice. You're MUCH better off with fewer partitions. Less wasted space, fewer filesystems to fsck, less room for "partition full" errors. My installation has /boot, swap (both "global"), and then a / and a /home for each distro. I have a couple of others that aren't relevant here.

2. Take haertig's advice, also. LVM is *very* nice. No need to *ever* worry about running out of disk space that way. I use it exclusively.

Last edited by grndrush; 01-04-2009 at 01:45 PM. Reason: add partition example
 
  


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
vi editor in ubuntu8.1 visitnag Linux - Software 9 12-24-2008 01:43 AM
hard drive mounting problem in Ubuntu8.04 pr5439 Linux - Software 2 11-11-2008 06:26 PM
what is wrong with ubuntu8.10?why i can not install it? topheraholic Linux - Newbie 13 11-06-2008 07:40 AM
LAMP problem on ubuntu8.04 2beahacker Linux - Server 13 10-09-2008 12:34 AM
Sound problem Ubuntu8.04 kernel 2.6.24-19-386 cctv Linux - Desktop 0 09-09-2008 09:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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