1

I have just reinstalled Ubuntu after messing things up with chown in root directory.

I'm trying to save a new mount point for second hdd. sdb1 partition is already formatted as ext4.

The problem began when root directory on sda2 was running out of storage. I thought I had dropbox and megasync installed on sdb1 but the synced files were using storage in 2 locations. I uninstalled both apps from sda1 but it made no difference.

The mount point for sdb1 was originally /media but this path lead straight to root directory and was depleting storage. So I moved sdb1 to a new mount directory /hdd. This didn't solve the problem because that path also leads to root directory.

All tutorials I can find recommend mounting a second drive at either /hdd or /media. But if these are leading straight back to sda2 root partition, then surely I am going to quickly run in to the same problem. Then what is the point of having a second drive if it has to mount on the first drive?

I figure that I have misunderstood something fundamental - can someone please explain in plain speak what I am doing wrong and what I should do to mount the second drive so that I don't use up sda2 and so I can easily save large files to sdb1.

Ideally, I'd like Dropbox and Megasync files to sync to sdb1. If that's not possible I can stop them syncing. As a minimum I'd like sdb1 accessible in Dolphin so that I can save large files and backups there without encroaching on sda2 space.

Thanks in advance.

Operating System: Ubuntu Studio 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 6.2.0-1018-lowlatency (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Xeon® CPU E5-1650 v3 @ 3.50GHz
Memory: 31.3 GiB of RAM
Graphics Processor: Quadro K2200/PCIe/SSE2

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 4K 1 loop /snap/bare/5 loop1 7:1 0 63.4M 1 loop /snap/core20/1974 loop2 7:2 0 237.2M 1 loop /snap/firefox/2987 loop3 7:3 0 349.7M 1 loop /snap/gnome-3-38-2004/143 loop4 7:4 0 91.7M 1 loop /snap/gtk-common-themes/1535 loop5 7:5 0 53.3M 1 loop /snap/snapd/19457 sda 8:0 1 238.5G 0 disk ├─sda1 8:1 1 300M 0 part /boot/efi └─sda2 8:2 1 238.2G 0 part /var/snap/firefox/common/host-hunspell / sdb 8:16 1 1.8T 0 disk └─sdb1 8:17 1 1.8T 0 part sr0 11:0 1 1024M 0 rom

user535733
  • 62,253
  • 1
    See the "Original Answer" part of this answer for one way of doing it. If your partition of the second drive is not mounted (automatically) you may be putting files on the first drive. Make sure your /etc/fstab is correctly set up. – user68186 Dec 29 '23 at 03:30
  • Just an FYI: The system i'm using now is located on a ~250GB SSD that is dual booted (my current Ubuntu noble release, plus a Ubuntu jammy (22.04) release) with my root partition ~95GB in size. If I was however to add up what is mounted on my ~95GB partition, it'll add up to near 20TB as I have many file-systems mounted on it (refer to @user535733's explanation) most of which are network storage mounts. There are pros & cons with everything (which includes your /hdd & /media !!) but you can do whatever you like ... – guiverc Dec 29 '23 at 06:32
  • ... including mount something more than once; ie. use /media (which will allow snap packages to use that data) and use /hdd too (if you prefer it, for other apps). I have some network file-systems mounted twice myself, as I prefer one method, but also use /mnt/ versions for snap packaged apps (that can't use my preferred mount point). You're limited mostly to whatever suits you (though if in a corporate environment, to whatever company polices allow for anyway). – guiverc Dec 29 '23 at 06:34

1 Answers1

1

Your question includes some fundamental misunderstandings about how mount points and storage works.

The output of lsblk may be confusing when you are looking at disk space use and directory structure. The directories listed in lsblk may not be current or correct and show partition size rather than disk space used. Use df -h for a more current and accurate view of your mounted disks.

Uninstalling software typically only releases a very small amount of space. Likely, it is not the software but the data that software downloaded that uses the space. Removing the software will not remove the data, and will not restore the free space. You need to find the data and delete or move the data, not the software.

It makes no sense to say "a mount point's space leads directly to root directory". All directories in a unix system are children of the root directory, that's what makes it the root directory. But mounted disks do not take any space on the root filesystem.

Also, mounting a new disk won't release any space on your root filesystem. To release the space, you have to move files to the new disk. If you want to save files to the new disk, you mount it to some directory and move the files to that directory after it is mounted.

Any empty directory can be used to mount a disk. The /media directory is typically used to automatically mount removable disks, and directories under media are created to do this. A directory under /media would be a fine place to leave a disk mounted temporarily, like what would be needed while moving a directory in the root partition to it.

If this is a permanent internal disk and is large enough, possibly what you want to do is move your entire /home directory to it. Unless your home directory has no important data, this can be tricky to do correctly without data loss. If the new disk is large enough to hold all of /home (use cd /home ; du -sh to check the current size of /home) then this question has directions:

Move home folder to second drive

user10489
  • 4,051