LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   adding space on the left (sdb1) to root directory (sdb5) (https://www.linuxquestions.org/questions/linux-newbie-8/adding-space-on-the-left-sdb1-to-root-directory-sdb5-4175590866/)

Yeldraw 10-06-2016 02:05 AM

adding space on the left (sdb1) to root directory (sdb5)
 
I started with the standard swap, /, then /home directories.
I now want more root space. I pinched 4Gb from sdb6(home)and made it a 4Gb swap file, now activated. The old too big swap file at 7.5Gb was reformatted to ext4 as seen below and sits on the left of the / directory. All done in live Gparted. But I can't see how to add the 7.5 ext4 sdb1 into the root directory. Resize/move no good for it.
I thought 40Gb was heaps for any Linux but don't see what I can delete.
And I know I am not alone.


Disk /dev/sdb: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000e3f60

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 15624191 15622144 7.5G 83 Linux
/dev/sdb2 15626238 250068991 234442754 111.8G 5 Extended
/dev/sdb5 15626240 93848896 78222657 37.3G 83 Linux
/dev/sdb6 93849600 241815551 147965952 70.6G 83 Linux
/dev/sdb7 241817600 250068991 8251392 4G 82 Linux swap / Solaris
===========================
david@David ~ $ sudo df -h
[sudo] password for david:
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 793M 9.4M 783M 2% /run
/dev/sdb5 37G 31G 4.3G 88% /
tmpfs 3.9G 36M 3.9G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sdb6 70G 8.1G 58G 13% /home
cgmfs 100K 0 100K 0% /run/cgmanager/fs
tmpfs 793M 28K 793M 1% /run/user/1000
/dev/sdc1 194G 60M 184G 1% /media/david/exthddpart
/dev/sdc2 400G 77M 400G 1% /media/david/6A53EC3E2BD3B550
david@David ~ $
========================================

IsaacKuo 10-06-2016 09:33 AM

In my experience, this has worked:

1) Boot to LiveCD, run gparted

2) Delete sdb1 partition

3) Resize/move extended partition sdb2 to encapsulate the free space to the left.

4) Resize/move sdb5 to expand it into the free space to the left.

The important thing is that sdb5 must have the same UUID afterward that it did at the start. My experience with gparted is that this sequence of events WILL maintain the same UUID.

I'll not that sdb7 is called a "swap partition", not a "swap file". A swap file is actually a file inside of a file system partition (such as ext4). I find that generally a swap file is more convenient than a swap partition, because they're easier to delete/create on the fly.

rtmistler 10-06-2016 09:44 AM

Quote:

Originally Posted by Yeldraw (Post 5614562)
I thought 40Gb was heaps for any Linux

It is more than enough space.

Consider using the du command to summarize where your disk space is being used. You're putting stuff into your root partition for no good reason.

IsaacKuo's answer is perfectly valid, however you should instead put that extra space into your /home partition, but first figure out why your root partition needs so much space.

syg00 10-06-2016 05:02 PM

On all my images/machines I set my root (usually everything except /home) to 20G - only recently changed from 15G, so I agree there has to be something there to delete. Might be logs, might be package manager, might even be packagekit (if gnome).

yancek 10-06-2016 05:39 PM

Your root partition (sdb5) is a logical partition within an Extended partition and sdb1 is a primary partition which is why what you tried won't work. Make sure all the partitions are unmounted in GParted and the instructions in post 2 should take care of the problem.

mrmazda 10-07-2016 01:29 AM

A lot of space on Ubuntu (which seems to be what OP is using) can be freed by cleaning the cache.

Most of my / filesystems consume under 7G, and many don't use more than about half that much. I struggle to imagine how someone new to Linux can fill up a 37G / partition (unless using BTRFS, which makes freespace disappear in a big hurry).

Yeldraw 10-07-2016 02:31 AM

Root space
 
All the help got me there ok tks, I now have that 7.5Gb added to / which is now at 74%. Now I must work on why so much memory used....another thread I guess. I did delete some video files made from downloads and I have run that cache remove command.
You reinforce my woory about the 37Gb root, system files. Better than it was.
david@David ~ $ sudo df
[sudo] password for david:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 4034980 0 4034980 0% /dev
tmpfs 811236 9556 801680 2% /run
/dev/sdb5 46055832 31957556 11735812 74% /
tmpfs 4056168 77444 3978724 2% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 4056168 0 4056168 0% /sys/fs/cgroup
/dev/sdb6 72689952 3350308 65624112 5% /home
cgmfs 100 0 100 0% /run/cgmanager/fs
tmpfs 811236 20 811216 1% /run/user/1000
/dev/sdc1 202925928 60684 192534164 1% /media/david/exthddpart
/dev/sdc2 418837500 257756 418579744 1% /media/david/6A53EC3E2BD3B550
david@David ~ $

Yeldraw 10-07-2016 04:11 PM

Quote:

Originally Posted by mrmazda (Post 5614947)
A lot of space on Ubuntu (which seems to be what OP is using) can be freed by cleaning the cache.

Most of my / filesystems consume under 7G, and many don't use more than about half that much. I struggle to imagine how someone new to Linux can fill up a 37G / partition (unless using BTRFS, which makes freespace disappear in a big hurry).

==========================

Seems to me that many files in the / should be in /home but I don't know which ones or if I could safely move them.
I am using Mint18 Sarah, Cinnamon. Root is now 48Gb and 74% used!!
If I open the 'system files' at the bottom of the display it says 12Gb free.
However
If I click on the Icon, at the top menu (next to the arrows), then select 'properties' it counts up to only 9.5Gb which would be a good guess at what it should be. See:

Name /

Type Folder (inode/directory)

Contents 304,435 items, totalling 9.5 GB
(some contents unreadable)

Volume unknown

Free space 12.0 GB

So what files should not be in there. And my /Home of 76Gb is only 6.3% full.
It all works well, boots in 15 Secs, no known problems except the root is filling up instead of the /Home.

It's all very well finding more / space but if I keep going then I will end up adding my home directory to the root space. The REAL question is why is the / filling up.
I could do that I guess, make a home contents back up, empty it and then just add it all to root.

syg00 10-07-2016 04:19 PM

Try this
Code:

sudo du / -xh | sort -hr | head

rtmistler 10-07-2016 04:22 PM

Quote:

Originally Posted by Yeldraw (Post 5615208)
Seems to me that many files in the / should be in /home but I don't know which ones or if I could safely move them.
I am using Mint18 Sarah, Cinnamon. Root is now 48Gb and 74% used!!
If I open the system files at the bottom of the display it says 12Gb free.
However
If I click on the Icon at the top menu (next to the arrows) it counts up to only 9.5Gb which would be a good guess at what it should be. See:

Name /

Type Folder (inode/directory)

Contents 304,435 items, totalling 9.5 GB
(some contents unreadable)

Volume unknown

Free space 12.0 GB

So what files should not be in there. And my /Home of 76Gb is only 6.3% full.
It all works well, boots in 15 Secs, no known problems except the root is filling up instead of the /Home.

It's all very well finding more / space and if I keep going then I will end up adding my home directory to the root space.
I could do that I guess, make a home contents back up, empty it and then just add it all to root.

I have no better suggestion other than:
Code:

cd /
sudo du -Shd 1

And then observing the output of that to see which major directories contain all the fluff you don't want/need.

EDIT: What syg00 said! :) ^^^

Yeldraw 10-07-2016 04:29 PM

"Fluff"
 
Heh - my "work" is not "fluff".:)

Yeldraw 10-07-2016 04:48 PM

Root directory files/space
 
Well, I am getting close to doing a clean new install. It is on a dedicated 120Gb SSD so a default installation should put it right. Unless anyone has a recovery solution. The only headache for me would be re-installing all the lovely software.

david@David ~ $ cd /
david@David / $ sudo du -Shd 1
[sudo] password for david:
4.0K ./mnt
4.0K ./lib64
300K ./lib
0 ./sys
du: cannot access './run/user/1000/gvfs': Permission denied
44K ./run
4.0K ./home
4.0K ./opt
129M ./boot
4.0K ./srv
16K ./tmp
4.0K ./media
4.0K ./usr
4.0K ./var
17M ./bin
du: cannot access './proc/5634/task/5634/fd/4': No such file or directory
du: cannot access './proc/5634/task/5634/fdinfo/4': No such file or directory
du: cannot access './proc/5634/fd/3': No such file or directory
du: cannot access './proc/5634/fdinfo/3': No such file or directory
0 ./proc
4.0K ./cdrom
772K ./etc
16K ./lost+found
18M ./sbin
0 ./dev
16K ./root
8.0K .
david@David / $

Yeldraw 10-07-2016 05:04 PM

sudo du / -xh | sort -hr | head
 
Quote:

Originally Posted by syg00 (Post 5615212)
Try this
Code:

sudo du / -xh | sort -hr | head

Ok....Now what? Ah - there's that 9.5G which I saw before, a realistic system size. Does that suggest ALL below that should be in the /Home directory.
And if so - how on earth could I SAFELY move it???

david@David ~ $ sudo du / -xh | sort -hr | head
[sudo] password for david:
9.5G /
7.2G /usr
3.8G /usr/share
2.9G /usr/lib
1.5G /usr/share/games/0ad/mods
1.5G /usr/share/games/0ad
1.5G /usr/share/games
1.4G /usr/share/games/0ad/mods/public
1.3G /usr/lib/x86_64-linux-gnu
1.1G /opt
david@David ~ $

mrmazda 10-07-2016 05:38 PM

I wonder if /dev/sdb6 has always been mounted to /home when it should be. I'd try booting a CD, DVD or USB stick and checking to ensure /home on /dev/sdb5 is empty while /dev/sdb6 is unmounted. I'd also try forced fscks on all filesystems during that boot.

Yeldraw 10-07-2016 07:00 PM

OK - booted from live Mint CD and left sdb6 unmounted. Ran du as below and saved it on ext hdd using Office.
Looking in Accessories 'Discs' sdb6 was unmounted.
Selecting properties for sdb5 shows 4.1Gb used and 4.2GbFree. Quite different to my installed system.
Anyway - I think it will be quicker to do a clean install although the learning curve is fun...I may do a quick lookup on "circular dir structures" but I'm out of my depth.


mint@mint ~ $ cd /
mint@mint / $ sudo du | sort -n

du: cannot access './proc/3539/task/3539/fd/4': No such file or directory
du: cannot access './proc/3539/task/3539/fdinfo/4': No such file or directory
du: cannot access './proc/3539/fd/3': No such file or directory
du: cannot access './proc/3539/fdinfo/3': No such file or directory
du: cannot access './run/user/999/gvfs': Permission denied
du: WARNING: Circular directory structure.
This almost certainly means that you have a corrupted file system.
NOTIFY YOUR SYSTEM MANAGER.
The following directory is part of the cycle:
./sys/kernel/debug/pinctrl

.........................(rest of it deleted...very long).
Tks for the help.


All times are GMT -5. The time now is 04:46 PM.