How to make system file partitions larger without reinstalling

5,530

Solution 1

You have a 1TiB hard drive with only 10GiB or so used. While it would be possible to expand this 10GiB partition up to a TiB or any size in between, an alternative solution is to add another separate partition for your home directories.

For example, add a new partition (/dev/sda6) and move the contents of your /home directory to it (this will need to be done as root). Then modify your /etc/fstab so that this new partition is automatically mounted at /home every boot.

The process will go something like this (all carried out as root):

# fdisk /dev/sda
n
6
[Enter]
+500G

Next add a filesystem (format it):

# mkfs.ext4 /dev/sda6

Mount it:

# mount /dev/sda6 /mnt

Move the files over:

# mv /home/* /mnt

and unmount:

# umount /mnt

Modify /etc/fstab by adding a line similar to:

UUID=12345678-1234-1234-1234-1234567890ab   /home       ext4    defaults    1 2

where the UUID is found by:

# blkid /dev/sda6

Running mount -a will mount all mounts defined in /etc/fstab therefore you can test it with:

# mount -a

at which point you should be able to see all the relevant directories within /home.

Solution 2

The Standard of Practice is to enter into a Linux recovery environment. Any distribution Live-CD will enable you to access your computer in a manner appropriate to resize your hard drive partitions.

Resizing partitions is based on the ability to work on your drive without having the drive actually mounted.

$> fdisk -l

Invoking the command above will list your devices, i.e. (/dev/sda1/)

List your mounted drives (persistent drive mountings are stored in /etc/fstab:

$> mount

The umount command will unmount your drive, invoke as follows:

$> umount /dev/sda$

The administration utilities Parted or Gparted will resize your partitions. Be careful not to chop too much data off your partition! Understand how much you can really get away with based on how much is stored on your other partition. There are risks.

Use the search feature on your web browser to find specific instructions for how to resize a partition with GParted:

Please answer garethTheRed's comment to receive more specific answers.

garethTheRed: $> df -h

^ This will list how much space is used on your partitions.

GParted manual

Share:
5,530

Related videos on Youtube

Ben P
Author by

Ben P

Updated on September 18, 2022

Comments

  • Ben P
    Ben P over 1 year

    I'm using SteamOS. SteamOS I believe is Debian based.

    I wiped the laptop and got it installed nicely. When I started moving my music over I got this message: Error while copying to "Music". - There is not enough space on the destination. Try to remove files to make space.

    I assume, I need to make some sort of partition larger but I haven't been able to figure out how to do that?

    As requested:

    desktop@steamos:~$ sudo fdisk -l
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x116c49cc
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1  1953525167   976762583+  ee  GPT
    Partition 1 does not start on physical sector boundary.
    desktop@steamos:~$ df -h        
    Filesystem                                              Size  Used Avail Use% Mounted on
    rootfs                                                  9.3G  8.8G   27M 100% /
    udev                                                     10M     0   10M   0% /dev
    tmpfs                                                   739M  360K  739M   1% /run
    /dev/disk/by-uuid/12742cc0-e489-472e-aa10-974d078d98e0  9.3G  8.8G   27M 100% /
    tmpfs                                                   5.0M     0  5.0M   0% /run/lock
    tmpfs                                                   3.4G   25M  3.4G   1% /run/shm
    /dev/sda5                                               889G  119M  843G   1% /boot
    /dev/sda1                                               487M  128K  486M   1% /boot/efi
    /dev/sda3                                               9.3G  1.5G  7.4G  17% /boot/recovery
    desktop@steamos:~$ 
    
  • Ben P
    Ben P over 9 years
    I think we're on the right track. But when I went to unmount the partition that's using all the space I was faced with this : desktop@steamos:~$ sudo umount /dev/sda5 umount: /boot: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))
  • Tyler Maginnis
    Tyler Maginnis over 9 years
    You need to boot into a live Linux distribution, like the Ubuntu install CD. When you are not using the device, you will be able to unmount and resize the partition.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 9 years
    Plenty of filesystem/partition combinations allow a storage volume to grow live. This isn't “the standard of practice”, it's how you make do when you have an inferior operating system or setup (as is the case here, with PC-style partitions).
  • Tyler Maginnis
    Tyler Maginnis over 9 years
    I assumed we were talking about ext$ variants. This is the Standard of Practice for non-dynamic filesystems or whatever witchcraft you are talking about there, Gilles.