Resize /home partition

Big time linux noob here.

A colleague helped me with partitioning my PC and I’m looking for help in resizing my /home partition. I am running opensuse leap 15.1. A few looks at my setup:

Via fdisk -l:


Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SAMSUNG MZVLW256HEHP-000H1              
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: gpt
Disk identifier: 3359DE43-E4A9-48A8-AF25-BE58355EB381

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    534527    532480   260M EFI System
/dev/nvme0n1p2    534528    567295     32768    16M Microsoft reserved
/dev/nvme0n1p3    567296 328194047 327626752 156.2G Microsoft basic data
/dev/nvme0n1p4 498178048 500107263   1929216   942M Windows recovery environment
/dev/nvme0n1p5 328194048 493983743 165789696  79.1G Linux filesystem
/dev/nvme0n1p6 493983744 498178047   4194304     2G Linux swap

Partition table entries are not in disk order.


Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA DT01ACA1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E5D3001A-AAF0-47B7-AB22-7BCE8156676D

Device         Start        End    Sectors   Size Type
/dev/sda1       2048     264191     262144   128M Microsoft reserved
/dev/sda2     264192  825608191  825344000 393.6G Microsoft basic data
/dev/sda3  825608192 1953525134 1127916943 537.9G Linux filesystem

and via lsblk:


NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk 
├─sda1        8:1    0   128M  0 part 
├─sda2        8:2    0 393.6G  0 part 
└─sda3        8:3    0 537.9G  0 part /tmp
sr0          11:0    1  1024M  0 rom  
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 156.2G  0 part 
├─nvme0n1p4 259:4    0   942M  0 part 
├─nvme0n1p5 259:5    0  79.1G  0 part /home
└─nvme0n1p6 259:6    0     2G  0 part [SWAP]

I basically want to allocate some some of the sda3 partition to /home. 100 gb, let’s say. I tried to follow https://www.howtogeek.com/442101/how-to-move-your-linux-home-directory-to-another-hard-drive/ but I think attempting changes while on the mounted system wouldn’t let me unmount my partitions. This is the same issue I have had in trying to use the KDE Partition Manager.

Please let me know if I can restructure my question or provide any other command-line outputs to make my situation more clear.

Thanks.

you must first be aware of what file systems and partitions are. to reduce all the possible combinations to the most used, like you do, a file system must be contiguous and be on a partitions that is also contiguous. This you can not sinply say: let us tka esome space from disk sda3 and hang it somewhere into nvme0n1p5 to increase the size of /home. This is already physical impossible.

What you could do, is ceating a new file system aon either nvme0n1p5, or a part of it (after repartitioning) and hang that as a file system somewhere in /hone. E.g., when it is user xyz that fille /home with a lot of music, you could make /home/xyz/Music a separate file system and thus ofload all that music files from the /home filesystem to the new file system.

When you do not feel up-to-date about partitions and file systems, you could read: https://en.opensuse.org/SDB%3ABasics_of_partitions,_filesystems,_mount_points

Despite your colleague’s help, the mount point for the Linux root filesystem “/” seems to be missing – where is it?

  • There’s no indication of a Linux system partition on your system.

The KDE Partition Manager (RPM packet “partitionmanager”) is better suited to the KDE neon world – with openSUSE you should be using the openSUSE YaST Partition Manager: <https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-expert-partitioner.html&gt;.
[HR][/HR]Bottom line:

  • Before you begin resizing or moving partitions containing user’s files, make sure that, you have at least one, better two, backups of those partitions …
  • Before you begin resizing or moving partitions containing system files, make sure that, you have backups of the list packages installed on your system and, backups of the system configuration files – the “/etc/” directory tree.

hcvv” posted a very good command to retrieve a formatted list of installed RPM packages:

rpm -qa --qf '%{NAME}:%{VERSION}:%{RELEASE}:%{INSTALLTID}:%{SUMMARY}
' | sort

yes, very strange. I missed that (mainly because I tried to give the OP a general idea about what policy he should try to develop).
More info brings (as root)

lsblk -f

Maybe a

mount

can help here. And

cat /etc/fstab

BTW, @lwilgrant, you should not say things like: Via ldisk -f, you should incorporate the command (incuding the prompt) within your copy/paste. It is there, why not copy/paste, byt type seperate??

Hi @hcvv and @dcurtisfra, I appreciate the advice!

Using one of your suggested commands as root yields the output below. Is sda3 what you’re looking for re. the linux root file system?

linux-4f9a:/ # lsblk -f
NAME        FSTYPE LABEL            UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                     
├─sda1                                                                                  
├─sda2      ntfs   Data             3CB6B59BB6B5565C                                    
└─sda3      btrfs                   811d6976-a2b3-458e-ba59-e82a61fa7ed2  417.8G    22% /
sr0                                                                                     
nvme0n1                                                                                 
├─nvme0n1p1 vfat   SYSTEM           D699-3348                             100.6M    61% /boot/efi
├─nvme0n1p2                                                                             
├─nvme0n1p3 ntfs                    9220871E20870885                                    
├─nvme0n1p4 ntfs   Windows RE Tools 8CE8F65EE8F6464C                                    
├─nvme0n1p5 btrfs                   1e5c2c96-3383-4999-8bea-768d842cda1e   17.1G    77% /home
└─nvme0n1p6 swap                    f7d436f9-188c-48d8-9310-d80c44d3dc92                [SWAP]

And if it is useful for you to see the others:

linux-4f9a:/ # mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=8084704k,nr_inodes=2021176,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
/dev/sda3 on / type btrfs (rw,relatime,space_cache,subvolid=256,subvol=/@)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16725)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/sda3 on /usr/local type btrfs (rw,relatime,space_cache,subvolid=260,subvol=/@/usr/local)
/dev/sda3 on /boot/grub2/x86_64-efi type btrfs (rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi)
/dev/sda3 on /boot/grub2/i386-pc type btrfs (rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc)
/dev/sda3 on /var type btrfs (rw,relatime,space_cache,subvolid=259,subvol=/@/var)
/dev/sda3 on /srv type btrfs (rw,relatime,space_cache,subvolid=261,subvol=/@/srv)
/dev/sda3 on /root type btrfs (rw,relatime,space_cache,subvolid=262,subvol=/@/root)
/dev/nvme0n1p5 on /home type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sda3 on /opt type btrfs (rw,relatime,space_cache,subvolid=263,subvol=/@/opt)
/dev/sda3 on /tmp type btrfs (rw,relatime,space_cache,subvolid=258,subvol=/@/tmp)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1618772k,mode=700,uid=1000,gid=100)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
linux-4f9a:/ # cat /etc/fstab
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /                       btrfs  defaults                      0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=D699-3348                             /boot/efi               vfat   defaults                      0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /var                    btrfs  subvol=/@/var                 0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /tmp                    btrfs  subvol=/@/tmp                 0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /root                   btrfs  subvol=/@/root                0  0
UUID=811d6976-a2b3-458e-ba59-e82a61fa7ed2  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=1e5c2c96-3383-4999-8bea-768d842cda1e  /home                   btrfs  defaults                      0  0
UUID=f7d436f9-188c-48d8-9310-d80c44d3dc92  swap                    swap   defaults                      0  0


So sd3 is the root volume. It seems that your first lsblk was confused by the btrfs subvolume :(.

We are very keen on having good information about your setup. Meddling with partitions is always very tricky and prone to destroying file system (and thus also the advice to have not only your normal backup, but also some extra).

Now there are three ntfs file systems. Are thos parts of a Windows OS in a multi-boot situation?

While we are now getting a better idea about what you have, please explain where you want to go. You told already that you want to increase your /home file system. But I toold you you can not add space from the other disk. So please what should be your new layout. After we now that we can advise on how to advance from “now” to “new”.

basic facts. You can only add/remove to/from the end of a partition. so generally unless you have space after the end it requires some moving of partitions to resize. Partitions must be continuous. Be sure any important data at least is backeup before doing low level operations on partitions.

@lwilgrant:

You seem to have, a 1 TB disk with MS Windows and a Linux system partition on it.
Additionally, there’s a 256 GB drive with your Linux home partition on it plus, the UEFI partition used for boot and, some more bits of MS Windows on it.

What you can do is, rather than mess about with the existing home partition on the 256 GB drive, is to create a new directory under “/” on the 1 TB drive – name the new directory “home01” or whatever.
Under the new “homexx” directory create a directory named «your username», change the ownership of that directory to your user and group – use it.

The new “second home” directory is, from the point of view of the system, not a Btrfs sub-volume but, that doesn’t matter – there are system directories below “/” which are also not Btrfs sub-volumes …

Hi All.

Thanks for your responses.

After reading @hcvv’s suggested information I see that I used some inappropriate wording over resizing my /home directory. In general, I would like a larger home directory but was unsure how to approach this.

@**dcurtisfra **this is indeed my setup. I appreciate the explanation and I’m wondering a couple things:

  1. Despite the displays from “lsblk” that I shared, I’m having trouble conceptualizing the layout of how my computer is setup. Are you saying that there is a 256 gb drive (the linux /home partition and windows bits) which is partitioned from the original 1 tb, or that this is a distinct drive onto which the linux /home partitions etc. has been placed?

  2. As a follow up^, I think you mean the latter. In this case, why would my colleague not have put the linux /home directory onto the main linux partition from the 1 tb? Is it generally done this way so that I could theoretically have another flavor of linux on the 1 tb partition or am I sounding ridiculous?

Thanks for your patience, everyone!

I think Windows speak has you confused. Windows call partitions drives. But a drive is the whole disk in Linux. In Linux/Unix partitions are just partitions not drives.

run as root **fdisk -l **
this will show the partitioning of the drive.

lsblk will indicate the usage of the partitions

Also mount will show what partitions are currently mounted and where in the directory tree they are mounted ie the mount point.

cat /etc/fstab will show/controls what is to be mounted and where after system startup. If you follow some basic rules you can mount any partition almost anywhere in the file system tree at any time.

In Windows each “drive” has it’s own directory tree, in Linux/Unix there is only one tree and partitions are mounted to that single tree.

Please realise that, in a UNIX® / Linux / Mac OS «is a certified UNIX®» system “everything is a file”.
A *NIX user never “sees” a disk – only directories …

“fdisk -l” indicates that, you have a “Samsung MZVLW256HEHP-000H1” drive and a “Toshiba DT01ACA1” drive – the Samsung drive is a 256 GB device and, the Toshiba drive is a 1 TB device.

Your “/home” is on the Samsung drive and, your system “/” partition is on the Toshiba drive.

It doesn’t really matter what your colleague did; simply create a user directory (owner “root”; group “root”) under the “/” system partition on the Toshiba drive; create a further user directory for your user in the newly created directory – you’ll need to use the user “root” to achieve this – change the ownership of your newly created directory to your login user and, the group to “users”.

If you then look at the “/” system directory, you’ll see two directories “/home” and “/homexxx”, both with the owner “root” and the group “root”.

Within both these “user home” directories there can be user directories named «your username», both with the owner «your username» and the group “users”.

*NIX understand links, perfectly – forget everything that you believed you knew about links – learn the *NIX variant – it’s perfect …

  • You can create a symbolic link named “LotsOfDiskSpace
    ” pointing to /homexxx/«your username» – you can then seamlessly and transparently use this space from your normal login directory, as if it were within the the partition where your user login is located, except that, it’s somewhere else …

[HR][/HR]“Everything is a file”.