LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2014, 07:45 AM   #1
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Rep: Reputation: Disabled
ran out of space in usr


Hello guys, I installed debian on a virtual machine with btrfs and then went to install gnome but installation process was interrupted because of lack of space. I shrank the /home partition and wanted to add the space to /usr but lvdisplay command returns "command not found", also lvextend is not found, so my first question is why the lvdisplay command doesn't work under root user?
Then, I uninstalled ssh server in order to make some space but apt-get doesn't want to install anything else but wants to continue in gnome installation, I tried dpkg -P gnome but that doesn't work as it wasn't correctly installed yet. So second question is how do I make apt to install something if previous installation wasn't completed or how do I remove files associated with incomplete installation?

This is on a virtual machine which I want to use for technical exercises and I can easily delete it and start over but I'd like to know how to sort out these problems would I ran into them on a normal machine.

Any help is appreciated. Thank you.
 
Old 04-05-2014, 11:53 AM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Are you sure you're using LVM? It sounds to me as you are not (using LVM).
Also, removing ssh won't give you much more space.
What you can do is create a second disk and mount it under /usr. Well, of course you need to mount it elswehere first and then copy everything from /usr to it - including permissions.
Then edit /etc/fstab and delete everything under /usr. It might be that the system hangs before finished as you are deleting lots of system-files but then just reboot.
Or you could reboot using a live-cd and that way copy & delete /usr - safer & it will delete everything.

And remember, when asking questions please fill in all details. We don't know what virtualization engine you're using, what system on the host etc.
 
Old 04-05-2014, 12:14 PM   #3
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
hello pingu, thank you for the reply

sorry for lack of details, host OS is windows8 and VM is VirtualBox

am I using LVM? - I don't know - I'm a total beginner in filesystems, when I installed that Debian I chose guided partitioning with /var, /usr, /tmp etc on separate partitions and then change the fs on all of them to btrfs

using btrfs filesystem resize -1G /home worked fine and /home is smaller by 1GB but +1GB on /usr doesn't work ... I reckon that the volume needs to be expanded first in order to expand the partition, though I might be wrong, so I wanted to use lvdisplay to see the name of the volume in order to expand it by that freed 1GB but lvdisplay returns command not found

and also, can you please tell me how to copy contents of that /usr directory to say /mnt/tempusr inclusing permissions? Also, is there a way to copy them inclusing owner/group details? Is there actually different user/group than root in /usr?
I think I can manage to: create another HDD in VirtualBox, format, create /usr on it and mount that directory under that /mnt/tempusr I mentioned, copy everything over and then edit what? fstab? - I guess to mount that second HDD as /usr ... that's the correct way ... right?
 
Old 04-05-2014, 12:39 PM   #4
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Here's what I think:
1) You are not using LVM. (AFAIK Debian does not use lvm per default, whereas for example CentOS does. Not sure about this though.)
2) You could resize the /home partition as all space on the disk was not used. After increasing /home there is no free space on the disk.
I haven't fiddled much with Virtualbox, but maybe there is a way to add space to the first disk? I have done that several times but never in VB only running Xen.

Now for a how-to - well I should really let you do the research yourself but I'm in a good mood today :-)
To copy everything including permissions, as root (or with sudo if that is enabled) issue the command
# cp -a /usr/* /mnt/tempusr/

"Is there actually different user/group than root in /usr?"
Users - normally no but could be. Groups - yes. Also you need to be sure the permissions are correct, "cp -a" preserves owner, group & permissions.

For mounting a partition at boot, here's a sample line in /etc/fstab:
Code:
# /dev/sdb3
UUID=b2157eed-ef41-45c9-8724-1a1748f7486c       /usr/local      reiserfs        defaults        0 0
You find the uuid with "ls -l /dev/disk/by-uuid/"

A few useful commands:
fdisk -l (shows all disks & partitions - not usable if you have GUID/GPT.)
df -h (shows all mounted partitions with details)
df -T (shows all mounted partitions with filesystem details)
 
Old 04-05-2014, 01:56 PM   #5
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,129

Rep: Reputation: 232Reputation: 232Reputation: 232
If you think you might be using LVM (and you might).
Try
Code:
jeremy@hector:~$ sudo vgscan
  Reading all physical volumes.  This may take a while...
  No volume groups found
If you find any volume groups then you are using LVM.
If so, I can explain what's wrong - but it would be lengthy.
In any case there's no reason to put /usr in a LVM partition.
The VM in LVM does not stand for Virtual Machine!
 
Old 04-05-2014, 02:51 PM   #6
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
thank you very much, uncle google is my friend and he usually tells me what I need to know, I only asked because I was already asking thank you anyway for the hint on the -a option of cp command

and you didn't understand it well, all space was used and I shrank the /home partition in order to free some space and then enlarge the /usr partition by that freed space, but if I told the OS to resize + it didn't work saying there is not enough space on the partition so that's why I wanted to use LVM to enlarge the volume and then add space to the partition but LVM's commands were not working either, which leads me to 2 conclusions:
- the OS is stupid (excuse my language please) enough to let the user install a package which is bigger than available space and then the package manager doesn't have the option to remove last package which failed to get installed and remove all it's files/dependancies and revert itself to the point where it started before the installation - in my case, I ran out of space, apt-get won't accept any new installs, instead wants to only and only finish installation of gnome and it's dependancies , dpkg doesn't want to remove gnome because no gnome is installed, --reconfigure -a doesn't help either
- when selecting btrfs as a file system when installing the OS, I'd presume, that it comes with a volume manager as you'll probably want to use its features after you choose it and initially divide your HDD at the time of OS installation

Well, thank you once again, I'll play around with it and hopefully, this will at least server as a lesson to check the free space available before installing something

EDIT:
Jeremy thank you for your post as well, as I said now, I presumed that the system will come with a Volume Manager (LVM = Logical Volume Manager ... right? ) I just didn't know whether it is what exactly is LVM and what exactly is it used for, that means - can I use it with btrfs or it works with ext* only, or? ...

Last edited by esso82; 04-05-2014 at 02:56 PM.
 
Old 04-05-2014, 03:25 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,399

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
You can use LVM with any filesystem (it's just a container, analogous to a partition), but using LVM with btrfs would be extremely unusual since btrfs provides most of the same features as does LVM (snapshots, multi-device spanning, subvolumes, ...). There is little point in layering one complex beast on top of another that is doing a similar job.
 
1 members found this post helpful.
Old 04-05-2014, 03:31 PM   #8
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
No, you got it all wrong here. LVM is not just some tool to handle any volumes! It's more like, well don't take it literally but think RAID here. You use several disks/partitions as if they were one.
So you have to install lvm and then assign partitions et al to it.
Like this:
You have:
disk1, partition1 = 10GB
disk2, partition3 = 20GB
You create a VolumeGroup consisting of disk1, partition1 & disk2, partition3. Now you have one logical volume size 30GB.
You can now create "partitions" in this VolumeGroup, they are called "logical volumes" (not to be confused with Logical partitions"!).
You could say that the VG is like a disk, the logical volumes are like partitions. The main difference is you can easily add space to the disk, resize the partitions, without needing to bother about physical disks.
So, after creating the logical volume you format it, just like you would a traditional partition. With btrfs if you like, or ext3, or reiserfs or whatever.
(Sorry if I'm not very clear, it's actually bedtime in my part of the world. Hopefully you get the picture.)

As for your other questions:
" the OS is stupid enough to let the user install a package which is bigger than available space "
Correct. OS - or rather the package management tool - does not calculate space needed. If you run out of space installation stops.
Try "apt-get -f install" or maybe remove some packages that couldn't be installed like "apt-get remove gnome2". Taking all this from memory now, I can check more tomorrow if you haven't sorted it out (and nobody else comes to rescue).
 
Old 04-05-2014, 03:33 PM   #9
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Quote:
Originally Posted by rknichols View Post
You can use LVM with any filesystem (it's just a container, analogous to a partition), but using LVM with btrfs would be extremely unusual since btrfs provides most of the same features as does LVM (snapshots, multi-device spanning, subvolumes, ...). There is little point in layering one complex beast on top of another that is doing a similar job.
Interresting! I thought btrfs was just another file system, now I'm definitely going to get a closer look into it!
 
Old 04-05-2014, 03:43 PM   #10
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Quote:
Originally Posted by esso82 View Post
using btrfs filesystem resize -1G /home worked fine and /home is smaller by 1GB but +1GB on /usr doesn't work
This is strange though. I take it you have only one virtualbox "disk" here? Then this should actually work if you got the syntax right.
Maybe it's a 1000/1024 confusion? That is, 1GB is sometimes calculated as 1000MB but it is actually 1024MB. If so, adding 900MB will work.
Or maybe the space you made free still was in use and so was not actually freed? Never used btrfs, but have had some issues with disk space not being immediately freed when deleting files.
A drastical way to try it out is rebooting, a better way in the long run is to study btrfs options.
---
You did use the btrfs filesystem resize to expand /usr, right? You did not first shrink /home with btrfs resize and then tried to increase /usr with lvexpand?

Last edited by pingu; 04-05-2014 at 03:48 PM.
 
Old 04-05-2014, 03:49 PM   #11
esso82
Member
 
Registered: Aug 2013
Location: Plymouth, UK
Distribution: SolydK
Posts: 45

Original Poster
Rep: Reputation: Disabled
thank you guys for bringing some light into this, I understand what LVM does, but I'm still confused about btrfs - does it use it's own volume manager? Can we say, that btrfs file system use a volume manager similar to LVM? What is the advantage of using say ext3 + LVM over btrfs then? - that btrfs is fairly new and possibly buggy? Something else?

I do what I do because I want to build a home server for my family, and, partly fed up with microsoft, partly hunger to learn new things, I opt for linux and as I read, Debian might be what I want to install on it, that's why I chose Debian. And one of first things I have to decide is, what FS to go for, so I want to play around with btrfs before I'll install it on a real machine, I had the pleasure to have Ubuntu with ext3 on my old laptop but there was no real chance of HDD expansion. Off topic now a bit, would you recommend to use btrfs on home server? What if one of drives fail, will I loose everything in the pool? Or is there a better solution to have the most music for the least money?

Bedtime here as well, sogd night guys.
And thank you, I used linux a bit before but I see I'm still far away from calling myself experienced-linux-user

EDIT:
rknichols actually answered my question about comparing LVM and btrfs - thank you
pingu - one HDD in my VM but separate partitions for /home /var and so on .. that might be why it didn't allow me to do that, need to ask uncle google how to resize the volume as well as I probably only shrank the volume where /home is, then I need to shrink the partition, expand the one where /usr is and then expand the volume ... I might be talking sci-fi now LOL .. that's how it comes to my head at late evening time, will have a look into it tomorrow
You did use the btrfs filesystem resize to expand /usr, right?----yes I did, but it didn't work,that's why I tried LVM thinking that that is the manager for btrfs
THANK YOU

Last edited by esso82; 04-05-2014 at 03:57 PM.
 
Old 04-05-2014, 08:38 PM   #12
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,129

Rep: Reputation: 232Reputation: 232Reputation: 232
Quick description of LVM (Logical Volume Manager).
It is not RAID.

You start by allocating one (or more) Physical devices (partitions).

You then allocate several Physical devices to a Volume Group.
It is probably quite common to put everything into one Volume Group.

Finally you create as many Logical Volume(s) as needed in the Volume Group.
But it is just empty space.
You need to create a file system in this empty space - you have chosen btrfs - but I'd probably choose ext4...

It is easy to increase space allocations in LVM.
1. You would increase the LVM allocation.
2. You would extend your btrfs file system into the larger area.

It is hard to decrease space allocations in LVM - especially if you do it in the wrong order.
1. Reduce your file system by a "bit more" than the final reduction.
2. Reduce your LVM allocation so it won't mess with any of your file system data/control blocks.
3. (Optional) Extend your file system to use up any free space in the Logical Volume!
Actually, it's probably better to do a full data backup and restore into the new area.

Last edited by JeremyBoden; 04-05-2014 at 08:40 PM.
 
  


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
[SOLVED] Ran out of root space! Laxman_prodigy Slackware 20 08-11-2012 06:32 PM
ran out of disk space var qwertyjjj Linux - Newbie 5 10-06-2011 07:08 AM
Ran out of disk space on / fof3 Linux - Newbie 5 12-17-2007 07:27 PM
i think i ran out of space simeandrews Linux - General 6 09-01-2005 02:54 PM
Help ran out of space on root synapse Slackware 7 11-10-2004 12:46 PM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration