Create subvolume for /home in snapper

Hi!

Somehow during installation I must have said not to create /home in a separate volume, because right now it shows up in my snapshots, which I’m not too happy with, since I wouldn’t want to revert the content of my home directory if the system is messed up…

Can I create the subvolume now, and get it out of the snapshots?

Thanks!

Show use why you think so? Do you have no home partition??

no, home is not on a separate partition. Is this what I should do, create one?

Creating what you should already have from the beginning is a good idea IMHO, but I assume you need help here.

But, when people, that try to help you, ask you for information, like gogalthorpe does above (he asked; show), it is friendlier and better to provide it, or give a very good reason why you don’t (which could include that you do not know how to to it and ask for help to get the information). Just ignoring such a request may result in helpers going to a more promising thread.

Please show us ouput, between CODE tags, the # in the editor of

cat /etc/fstab

Since this is a fresh install I’d re-install and double check at the partitioning phase of the installer. Have 50-60GB for btrfs on /, give the rest to swap and /home to your preferences.

Even if you don’t use a separate home/home should not be included in the snapper snapshots why do you think it is??

thank you all for your replies.

First of all, apologies if it came across disrespectful, I just didn’t understand what gogalthorp meant by “Show use why you think so?”.

This is the content of my /etc/fstab file:

UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /       btrfs   defaults 0 0 
UUID=D0CE3A31CE3A1068   /windows/C      ntfs    defaults 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /var    btrfs   subvol=/@/var 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /usr/local      btrfs   subvol=/@/usr/local 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /tmp    btrfs   subvol=/@/tmp 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /srv    btrfs   subvol=/@/srv 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /opt    btrfs   subvol=/@/opt 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /boot/grub2/x86_64-efi  btrfs   subvol=/@/boot/grub2/x86_64-efi 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /boot/grub2/i386-pc     btrfs   subvol=/@/boot/grub2/i386-pc 0 0 
UUID=C439-6DC9  /boot/efi       vfat    defaults 0 0 
UUID=31bed850-e7ff-46e0-b11d-c14433790ebf       /.snapshots     btrfs   subvol=/@/.snapshots 0 0 
UUID=25f8ff9c-2caa-4f99-ae95-bd81baf1852e       swap    swap    defaults 0 0 

This is not a fresh install, it’s been like this for a few months, and I’d rather not reinstall if possible… The thing is that yesterday I started looking into snapper and learned a bit on how it works, and saw that on this computer it seems to be backing up /home. I think it is included because if I look into the snapshot directories within /.snapshot I can also see the content of my home directory.

I didn’t initially want a separate partition for home because the space for linux (I’m dual booting) is already quite small (51GB in total) and I didn’t want to fragment it.

Thanks all!

Above is your original post where you say that you did not make, for what reason, a separate /home volume. Now a volume can be a disk, a disk partition, a LVM logical Volume, a Linux RAID device, … We assumed you mean a partition because you talk about the installation where you might have switched off a separate /home (and in the installation it is normally on a partition).

Then you say that it “shows up in your snapshots”. People asked you why you think so. Please take care that you only gave your “conclusion”, but not where you conclusion is based on. We, the helpers, are a bit stubborn in that we do not believe conclusions, we only believe computer facts. So please tell us, better SHOW us why you think so. Then we can come to our own conclusions, which may help you to understand what is going on.

Then you ask “Can I create the subvolume now, and get it out of the snapshots?”. Now that is very confusing, because when there would be (or will be as you ask for) a subvolume, then in earnest /home will be subject to snapshots taken. So what you ask here is 180⁰ contrary to what you want.

You probably want to have /home on a separte partition (as the default installation will do).

So please:

  1. show us why you think /home is snapshotted;
  2. to increase our knowledge so we can help you in moving /home to a separate partition by showing
fdisk -l

and

ls -l /dev/disk/by-uuid

.

BTW, your fstab shows that you have no separate partition for /home, but it also shows no subvolume for /home, thus it is very unlikely it will be snapshotted.

This is why I think it’s being snapshotted, I may be wrong:

# ls /.snapshots/160/snapshot/home/eiboaa/
.bash_history              Desktop     .hplip                       .ssh
.bashrc                    Documents    bin                        Downloads             .nv          
.cache                     .emacs      .inputrc                     .pki                         
.color                     .esd_auth   .java                        .profile                        .thunderbird
.config                    .fonts      .kde4                     .recently-used                  .xim.template
 .gnome      .local                        .xinitrc.template
.cups                      .gnupg      .lyx       .y2log
.dbus                      .gtkrc-2.0                       .y2usersettings

if it wasn’t snapshotted I would expect /.snapshots/160/snapshot/home to be empty.
For instance

ls /.snapshots/160/snapshot/opt/

returns nothing, even though /opt is not empty, so I guess /opt is not in the snapshot.

Now, if what I wrote before is confusing it is probably because I used the term subvolume wrong, so please ignore it. What I want to achieve is that the content of /home is not in snapshots, so that I can restore a snapshot without overwriting my home. How would I go about that?

# fdisk -l
Disk /dev/nvme0n1: 232.9 GiB, 250059350016 bytes, 488397168 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: gpt
Disk identifier: 863085FE-EB46-49D5-9133-813A33A6C855

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048   1023999   1021952   499M EFI System
/dev/nvme0n1p2   1024000   1286143    262144   128M Microsoft reserved
/dev/nvme0n1p3   1286144 362309631 361023488 172.2G Microsoft basic data
/dev/nvme0n1p4 483522560 488396799   4874240   2.3G Windows recovery environment
/dev/nvme0n1p5 362309632 467193855 104884224    50G Linux filesystem
/dev/nvme0n1p6 467193856 483522559  16328704   7.8G Linux swap

Partition table entries are not in disk order.


# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 15 Apr  7 19:11 25f8ff9c-2caa-4f99-ae95-bd81baf1852e -> ../../nvme0n1p6
lrwxrwxrwx 1 root root 15 Apr  7 19:11 31bed850-e7ff-46e0-b11d-c14433790ebf -> ../../nvme0n1p5
lrwxrwxrwx 1 root root 15 Apr  7 19:11 9CA43AADA43A8A32 -> ../../nvme0n1p4                                                          
lrwxrwxrwx 1 root root 15 Apr  7 19:11 C439-6DC9 -> ../../nvme0n1p1                                                                 
lrwxrwxrwx 1 root root 15 Apr  7 19:11 D0CE3A31CE3A1068 -> ../../nvme0n1p3


Thanks!

Thus Swap is on nvme0n1p6 and / is on nvme0n1p5.

Not much space left on the device.

I hope some btrfs guru will tune in to tell you if /home is snapshotted and why.

BTW, what is nvme0n1 fir type of device? Not the common SATA/USB mass-storage.

I don’t think any guru would help here. You have 50GB for the btrfs rootfs incl. everything, such as /home. If the 50GB is what you want to use for your openSUSE install, use 20GB for / on ext4, swap like prefered, the rest for /home on ext4.

To have /home not being snapshotted, you indeed need to create a separate subvolume for /home if it is not a separate partition.

You can use the btrfs command line tools for that, or (probably easier) YaST.
See https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.advdisk.html#yast2.btrfs
(and https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.advdisk.html#yast2.btrfs.yast in particular)
or https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-subvolume for the command line tool.

The installer should create a separate subvolume by default though if you untick “/home on a separate partition” during installation, unless you override that.

You can list all subvolumes of the root partition via “btrfs subvolume list /” (or see them in YaST).

thanks a lot, I think this is what I need. I’ll give it a try at creating the subvolume and write again if I have problems.

Now that you mention it I think that there was indeed a /home subvolume at the beginning. I believe I got rid of it when I thought I would mount /home from a NAS, which didn’t work out too well, so I’ve given up on that. I also have a little of a boot time problem, but I’ll create a separate thread about that.

Thanks