2

Has anyone seen this issue that can help me solve it? I have got a preinstalled server (Debian GNU/Linux 7.6 (wheezy)), where the disk space was partitioned very badly... :-( The Hardisk is very big but it is partitioned this way:

rootfs                                                     323M  320M     0 100% /
udev                                                        10M     0   10M   0% /dev
tmpfs                                                      406M 1012K  405M   1% /run
/dev/disk/by-uuid/aa26072b-e0f4-4962-ba44-76d5e65346de     323M  320M     0 100% /
tmpfs                                                      5,0M     0  5,0M   0% /run/lock
tmpfs                                                      2,4G     0  2,4G   0% /run/shm
/dev/sda9                                                  531G  6,4G  498G   2% /home
/dev/sda8                                                  368M   11M  339M   3% /tmp
/dev/sda5                                                  8,3G  2,2G  5,8G  28% /usr

TARGET                       SOURCE                                                 FSTYPE      OPTIONS
/                            /dev/disk/by-uuid/aa26072b-e0f4-4962-ba44-76d5e65346de ext4        rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=order
├─/sys                       sysfs                                                  sysfs       rw,nosuid,nodev,noexec,relatime
├─/proc                      proc                                                   proc        rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc binfmt_misc                                            binfmt_misc rw,nosuid,nodev,noexec,relatime
├─/dev                       udev                                                   devtmpfs    rw,relatime,size=10240k,nr_inodes=214285,mode=755
│ └─/dev/pts                 devpts                                                 devpts      rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
├─/run                       tmpfs                                                  tmpfs       rw,nosuid,noexec,relatime,size=414996k,mode=755
│ ├─/run/lock                tmpfs                                                  tmpfs       rw,nosuid,nodev,noexec,relatime,size=5120k
│ └─/run/shm                 tmpfs                                                  tmpfs       rw,nosuid,nodev,noexec,relatime,size=2507080k
├─/home                      /dev/sda9                                              ext4        rw,relatime,user_xattr,barrier=1,data=ordered
├─/tmp                       /dev/sda8                                              ext4        rw,relatime,user_xattr,barrier=1,data=ordered
└─/usr                       /dev/sda5                                              ext4        rw,relatime,user_xattr,barrier=1,data=ordered

/opt is linked to /home/opt and /var is linked to /home/var...

opt -> /home/opt
var -> /home/var

But when run apt-get upgrade or install some software it always fails... So can I expand the root partition in any way or create a symlink to some moutpoints somehow? Thank you very much for help.

2

In order to recover this installation, I suggest:

  1. download & boot RIP Linux (11.7 is a version I prefer, although there is 13.7 available too); if you have problems booting the ISO, remember that for RIP Linux is enough to start the kernel and rootfs.cgz as initrd, making it very simple to boot even from an existing installation
  2. with gparted resize your /home partition to leave room for a new root partition
  3. create the new root partition, ext4 filesystem for example
  4. use rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt/your-old-root/* /mnt/your-new-root/ to clone your root partition
  5. edit the /mnt/your-new-root/etc/fstab file to correctly mount the new / and /home partitions
  6. edit your bootloader (GRUB/GRUB2 for example) kernel parameter (that reads root=UUID=xxxxx) to match with the new UUID of the new root partition (lookup in ls -l /dev/disk/by-uuid/)
  7. reboot your system, then verify it's using the new root partition

NOTE: because of the critical nature of operations you would be making, you should consider making a backup and always referring to official documentation when you have a doubt. Stuff will break otherwise.

  • Thanks. I will try to get physical access to the server in short time, but until please Do you know about any option what I can delete for free up disk space? Because during apt-get upgrade was deleted mongodb and I need finish upgrade process for running important database... – Mato Sep 26 '14 at 19:11
  • I don't think apt-get upgrade will delete any db... you should simply fix this server, it can't work like this – Deim0s Sep 27 '14 at 7:18
  • It didn´t delete db, but mongod as software, so now I am not working with this database... – Mato Sep 27 '14 at 8:14
  • So problem with mongo will be separate chapter, upgrade has significantly damaged my mongo installation, I will start a new topic. – Mato Sep 27 '14 at 14:03
  • Please how can I edit grub2 in my case? What grub2 config file I can edit and what way? – Mato Oct 1 '14 at 18:27
2

The post is a bit old, but I ran through exactly the same problem (Debian as well) and running the following command as root solved it:

    apt-get clean

it released 2G of rootfs in my case (god knows why).

I got this hint from the following link, which seems very comprehensive:

https://wiki.maemo.org/Free_up_rootfs_space

0

Run du -x / to see what is occupying space on the root filesystem.

320MB is not much, but it should be ok as long as you have a single kernel package installed. Remove all the kernel versions except the one you want to reboot to.

Run dpkg -l 'linux-image-*' to see what kernel packages are installed. uname -rshows which version you're running now, but if you upgraded the kernel since the last reboot, you'll want to uninstall that and keep the latest version. You can uninstall the running kernel; this will prevent you from loading modules, so after doing that you may not be able to connect new peripherals, use new networking features, etc.

You should still enlarge the root partition, because having two kernel packages installed is common during an upgrade (the running kernel plus the latest version; remove the old kernel after rebooting, once you know the new version works).

If removing kernel packages isn't enough, what to do will depend on what is taking space. Quite a bit of what is in /bin, /etc, /lib and /sbin is necessary to mount other partitions, so you can't just move these directories to another filesystem. In a pinch, moving /lib/modules may be ok (it isn't in general, but it is in many configurations, as long as the filesystem you move it to doesn't require different drivers from the root partition).

0

Another alternative:

HDD are cheap ($50 will buy you a 500GB HDD, and under $100 for a 1TB HDD).

Install a second HDD and install a fresh, new install of linux.

For safety, disconnect the current HDD prior to install, then install the new HDD and the new Linux, then reconnect the old HDD, and rsync everything you want to keep onto the new HDD.

You can leave the old HDD connected for backups, et al.

  • thanks, but the same question: When I applied this solution, please how can I edit grub2 in my case? What grub2 config file I can edit and what way? – Mato Oct 1 '14 at 21:36
0

Just a thought. There might be hidden files on the rootfs partition. Remount rootfs on mnt and check the sizes of /mnt/home, /mnt/var, /mnt/opt, /mnt/usr, /mnt/dev, /mnt/sys, /mnt/proc, /mnt/run and /mnt/tmp.

mount --bind / /mnt
du -s /mnt/home /mnt/var /mnt/opt /mnt/usr /mnt/dev /mnt/proc /mnt/sys /mnt/run /mnt/tmp

Those directories should be mostly empty (their contents are located on other filesystems). I checked on my system and actually /mnt/dev has a few devices (they might be necessary at boot time).

If this is not the issue, run

du -s /mnt/*

As a very basic reference, the values on my laptop are:

7564    bin
8944    sbin
151284  lib
4       lib64
6928    etc
18288   boot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.