You are not logged in.

#1 2019-07-15 20:09:54

felixdatboi
Member
Registered: 2018-11-01
Posts: 26

Generating a new fstab post installation

So I have a 128gb SSD hard drive. When I installed arch I partitioned it to:

sda1: /efi      - 1GB
 
sda2: /           - 40GB (I know a bit excessive perhaps)

sda3: swap - 2GB

sda4: home - 76GB


The thing is, today I checked my disk space with `df -h` and saw that my sda2 was nearly full, and that my sda4 was almost unused. It also shows sda2 to be mounted on root and sda4 to some wierd place (`/run/media/<username>/d1517907-b9a8-4804-b3f3-7448c2267058`)

Using `ncdu` i checked what is taking up so much space, and found out that a lot of space is occupied by movies in my home folder (suprise, lol). I removed some of the movies and checked again with `df -h` and saw that sd2 was cleared of the space.

Can I now simply copy my ~ folder to /run/media/<username>/d1517907-b9a8-4804-b3f3-7448c2267058 and then do:

    $ mount /dev/sda4 /home/username

then

    $ genfstab -U /mnt >> /etc/fstab

This seems like a solution to the problem, but I dont know how the system will act if I "update" my fstab file.

Are there any other solutions?

Offline

#2 2019-07-15 20:19:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,791

Re: Generating a new fstab post installation

You could just edit the file rather than regenerate it.  man fstab will provide a good overview of the specific format.

There will be no impact on the system until you try to mount (or possible dismount) volumes.   If you get it wrong, you are likely to see it when next you boot.  Be sure you have a bootable install media before you try that.  If things go pear shaped, you can boot from the install media, fix it, and try again.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2019-07-15 20:25:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: Generating a new fstab post installation

You can update your fstab at any time.  It's just a text file read at boot.  You can edit it with any plain text editor too (rather than needing to mount and run genfstab, though there's nothing wrong with this approach either).

However, you will need to take care with your copying step.  The best approach would be to log in as root (in a tty) and ensure there are no other active log ins.  Then you can *move* everything from /home/username/ to the /run/media directory.  Note that if you don't move it but only copy, then it will still use space on sda2 for no purpose.

Also note that generally your home partition would be mounted on /home and include directories for each user, you'd not generally have a partition for a user.  I don't know that it'd cause any trouble, but unless you have specific reason to divert from it, I'd stick with the more standard approach.  So, while logged in just as root `mv /home/username /run/media/...67058/` (with the "..." filled in appropriately).  Then fix your fstab and reboot.

EDIT: obviously (in hindsight only) if you are logged in only as root, that udisks (or whatever) mounted path will not exist.  So instead mount /dev/sda4 somewhere and do the needed moves.  You'll need to create the "username" directory on sda4, then move everything else in the root of sda4 into the "username" directory.  Then mount sda4 at /home/

But before that, can we see what's *currently* in your fstab.  We might want to be sure we know how/why this happened before attempting the fix.

Last edited by Trilby (2019-07-15 20:30:25)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2019-07-15 20:26:34

felixdatboi
Member
Registered: 2018-11-01
Posts: 26

Re: Generating a new fstab post installation

ewaller wrote:

You could just edit the file rather than regenerate it.  man fstab will provide a good overview of the specific format.

Yeah I've tried to follow it. But I get stuck on the 4th 5th and 6th field. Perhaps its better to just re-generate it.

Offline

#5 2019-07-15 20:31:52

felixdatboi
Member
Registered: 2018-11-01
Posts: 26

Re: Generating a new fstab post installation

Trilby wrote:

However, you will need to take care with your copying step.  The best approach would be to log in as root (in a tty) and ensure there are no other active log ins.  Then you can *move* everything from /home/username/ to the /run/media directory.  Note that if you don't move it but only copy, then it will still use space on sda2 for no purpose.

Yea, my thought is that then I have a backup for it and if everything goes as planed, I can simply remove it. No?

Trilby wrote:

EDIT: obviously (in hindsight only) if you are logged in only as root, that udisks (or whatever) mounted path will not exist.  So instead mount /dev/sda4 somewhere and do the needed moves.

I do have a user account.

Trilby wrote:

But before that, can we see what's *currently* in your fstab.  We might want to be sure we know how/why this happened before attempting the fix.

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=ee6ecc3d-a667-4569-bb2f-6cf240787202	/         	ext4      	rw,relatime	0 1

# /dev/sda1
UUID=DCF0-A0B9      	/efi      	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/sda3
UUID=4c65a54c-ce78-4f7c-ade8-d9b544e3390d	none      	swap      	defaults,pri=-20 0

Offline

#6 2019-07-15 20:39:31

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: Generating a new fstab post installation

Fstab provides more information for fields five and six.  For field four (the options field) as the man page notes the minimum is ro or rw.
gen-fstab copies the options string a filesystem is mounted with from the output of mount for the value of this field,  you can find filesystem specific options in the relevant man / wiki page.

Offline

#7 2019-07-15 20:52:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: Generating a new fstab post installation

felixdatboi wrote:

Yea, my thought is that then I have a backup for it and if everything goes as planed, I can simply remove it. No?

That's true.  Just remember to go back and clear it out once you are satisfied with the solution.

felixdatboi wrote:

I do have a user account.

If you are copying content then my point is irrelevant.  If you are moving everything from a home directory, though, you'd not want to be logged in as that user.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB