[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Upgrading Kernel - Out of Disk Space



Stephen R Guglielmo wrote:
> I updated my apt repo and there was a kernel update. I ran the update,
> and received an error claiming "no space left on device." Normally, I
> would do a force-uninstall for the currently running kernel (freeing
> space), then install the new kernel and reboot. However, this is an
> update, not a replacement. I'm not sure how to proceed. When I
> installed this system, I selected automatic partitioning with an
> encrypted LVM, so I imagine resizing the partition would prove
> difficult. I'm not sure why the automatic partitioner didn't provide
> for enough space for future updates. See below for the relevant logs.
> This is on Debian Jessie.

> Filesystem                Size  Used Avail Use% Mounted on
> /dev/mapper/lapsdeb-root  314M  237M   57M  81% /

Very small.

> /dev/mapper/lapsdeb-home  274G  8.5G  252G   4% /home

Very large.  (The default for the debian-installer is to give all of
the remaining space to the last partiton.  IMNHO that is bad.)

> /dev/mapper/lapsdeb-usr   8.2G  2.6G  5.2G  34% /usr

Using less than 3G for /usr.

If it were me I would back up /home to some place else.  Verify that
/home is backed up.  Then I would lvremove /dev/lapsdeb/home to free
up that large amount of disk space.  Having that free disk space
available for use I would then 'lvextend -L+3G /dev/lapsdeb/root' to
add some of that space to it.  Use 'resize2fs /dev/lapsdeb/root' to do
an online expansion of the root file system to the now larger space.

Then I would 'lvcreate -L100G -nlapsdeb home' to create a new /home
partition.  Use mkfs to create the file system.  Mount it.  Then
restore /home from backup.  That would give a fully working system
rather easily without need for re-installing anything.  (Other than
the backup and restore of /home to reclaim some of that space.)

Sizes are of course open for changes.  /home is only using 8.5G now.
I start with 100G and be flexible from there.  that would leave
somewhere around 150G of free space in LVM available for future online
expansion whenever needed.  LVM works very nicely for expanding
space and resize2fs can increase the size of file systems online.
Works very well.

Shrinking filesystems with resize2fs on the other hand does not work
well.  Avoid shrinking.  That is why I would backup, remove, recreate,
restore rather than shrinking.

My Wheezy 7 media machine has a little more than 3G in /usr.  When
using a separate /usr the root partition doesn't need to be very big
at all.

  Filesystem           Size  Used Avail Use% Mounted on
  rootfs               5.5G  643M  4.6G  13% /
  /dev/mapper/v6-usr    28G  3.2G   23G  13% /usr

As you can see I have not bothered with converging / and /usr together
yet on my machine.  At some point I might be forced into do so.  If I
were then I would expand the root fs as much as needed then boot using
the debian-installer in rescue mode then copy the /usr partition up to
/ and remove the /usr partition and the entry from /etc/fstab.  Then
reboot to the new system without a separate /usr.  (Creating a
separate /usr is the same thing in reverse.)

This kind of file system surgery with LVM and resize2fs is actually
quite easy.  It is however file system surgery and as with any surgery
care must be taken to ensure a good result.  Not for the faint of
heart.  Always make sure you have a good full backup in case a mistake
is made along the way.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: