Root user files storage

New to Debian (Or Linux in general)? Ask your questions here!

Root user files storage

Postby forneus » 2017-11-07 20:27

Hi

When I'm using the root account and save files in root home folders - on which partition are they stored? Do they stay on system partition or the /home partition? Here is my partition scheme:

Image

Also, on a different topic, is there a way to change the numbers? Not a big deal but I would like to have Partition 1, 2, 3 instead of 1, 2, 5, 6.
User avatar
forneus
 
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

Postby 4D696B65 » 2017-11-07 21:06

forneus wrote:When I'm using the root account and save files in root home folders - on which partition are they stored? Do they stay on system partition or the /home partition? Here is my partition scheme:
Roots home is in /root
forneus wrote:Also, on a different topic, is there a way to change the numbers? Not a big deal but I would like to have Partition 1, 2, 3 instead of 1, 2, 5, 6.
Not without moving stuff around. 5 and 6 are extended partitions inside primary partition 2. You can have only 4 primary partitions. That's why extended partitions start at number 5.
User avatar
4D696B65
 
Posts: 2060
Joined: 2009-06-28 06:09

Re: Root user files storage

Postby forneus » 2017-11-07 21:22

Thanks for the reply. Clear about numbering. Gonna leave it as it is for now.

As for the /root - still not clear, sorry. By saving files as root am I going to fill the Partition 1 (30Gb only) or do they go to Partition 2 (and then I'm not worrying about space limits)?

The reason I ask is that I plan to use root account to hide some big files and access them as root only. I know there is the .dot way and the encryption applets way but I don't want to do that. So I'm curious how much space I am going to have after saving files as root and which partition is going to have those files.
User avatar
forneus
 
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

Postby RU55EL » 2017-11-07 22:02

How did you partition your hard drive?

Code: Select all
russel@NUC-G:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk
└─sda1   8:1    0 111.8G  0 part /home
sdb      8:16   0  29.5G  0 disk
├─sdb1   8:17   0    20G  0 part /
└─sdb2   8:18   0   9.5G  0 part [SWAP]
User avatar
RU55EL
 
Posts: 337
Joined: 2014-04-07 03:42
Location: /home/russel

Re: Root user files storage

Postby forneus » 2017-11-07 22:20

RU55EL wrote:How did you partition your hard drive?

Code: Select all
russel@NUC-G:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk
└─sda1   8:1    0 111.8G  0 part /home
sdb      8:16   0  29.5G  0 disk
├─sdb1   8:17   0    20G  0 part /
└─sdb2   8:18   0   9.5G  0 part [SWAP]


Image
User avatar
forneus
 
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

Postby p.H » 2017-11-07 22:28

forneus wrote:As for the /root - still not clear, sorry. By saving files as root am I going to fill the Partition 1 (30Gb only) or do they go to Partition 2 (and then I'm not worrying about space limits)?

The /root directory contents is on the / (root) filesystem. If it was on the /home filesystem it would be /home/root, not /root. The reason is that the root home directory must be available even if /home or any other filesystem fails to mount, so that the root user can log in and fix things.

IMO, you should not use /root for heavy storage. If you want to store big files as root, just create a /home/root directory and save files there.

When you want to check on which filesystem a directory is, you can use the "df" command.
Code: Select all
df /root


forneus wrote:is there a way to change the numbers? Not a big deal but I would like to have Partition 1, 2, 3 instead of 1, 2, 5, 6.

Yes. This requires to change the logical partitions into primary partitions or to convert the partition table to GPT and change the partition numbers.
You can use sfdisk to change logical partitions into primary partitions. Handle with care.

1) Dump the partition table.
Code: Select all
sfdisk -d /dev/sda > sda.ptbl

2) Edit sda.ptbl to delete the extended partition and change the partition numbers.
3) Write the new partition table to the disk.
Code: Select all
sfdisk--no-reread /dev/sda < sda.ptbl

4) Reboot.
Last edited by p.H on 2017-11-08 07:40, edited 1 time in total.
p.H
 
Posts: 179
Joined: 2017-09-17 07:12

Re: Root user files storage

Postby forneus » 2017-11-07 22:47

So just to be clear: I create /home/root (while in root account?) and and it's not going to be on a 30G system partition?

As for the changing numbering process: I don't need to reinstall Debian again? I thought dumping and writing new partition tables messes up everything and one does it only while installing OS. Does it really matter in terms of performance which numbers are assigned?
User avatar
forneus
 
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

Postby Segfault » 2017-11-07 22:59

Is this a joke of some sort? This installation I'm running right now has been in use over 9 years and there is less than 1 MB in /root. Just a few notes, handwritten logs about upgrades. Something is seriously wrong if your /root is filling up.
Segfault
 
Posts: 563
Joined: 2005-09-24 12:24

Re: Root user files storage

Postby forneus » 2017-11-07 23:34

Segfault wrote:Is this a joke of some sort? This installation I'm running right now has been in use over 9 years and there is less than 1 MB in /root. Just a few notes, handwritten logs about upgrades. Something is seriously wrong if your /root is filling up.


No jokes. After installation I first logged in as root. And /root had all regular folders(Documents, Music, Video..) so I assumed that root account can be used as /home. I let Debian do the partitioning during installation and I did not create any volumes. Now my question is can I store my personal files in, for example, /root/Documents (it already exists). These root folders belong only to a 30GB system volume or they can use my extended file partition (see screen shot above)?
User avatar
forneus
 
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

Postby GarryRicketson » 2017-11-07 23:49

by forneus »So I'm curious how much space I am going to have after saving files as root and which partition is going to have those files.

by Segfault » 2017-11-07 16:59
Is this a joke of some sort?

I am thinking maybe it is, even though the OP says it isn't. I mean look at the logic involved,... How could any one guess the answer to this , without knowing the size of the files to be saved ?
Of course the OP should know the size of any files they save, and logic would
dictate:. If you save a 3 gb file, in a directory or partition that has 30gb, then
you would have 27 gb space left.
One could save any files to any directory on any partition, where they get saved depends entirely on where the system is told to save them.
One can use chown, chmod, and chgrp to set the ownership and permissions
in such a way that only root has access. It does not even need to be in /root.

The logical thing to do is use the 'mkdir' command, make a directory in the big
partition, the one with the most room, it could be named /root-2 or /home or /mysecretfiles ,/home/root ...... what ever, just make sure the owner is root, and no others have permission to access it. Then save your secret files to that partition and directory.
Keep in mind, simply making/naming a directory "root" does not mean root is the owner, and others can not read or write to it, you need to set the permissions as desired .
If your /root dir is full, as root you can use the 'mv' command and move any files that you choose to another partition or directory of your choice. Just be sure not to move files that are system files and needed in the /root dir for system operation.
Code: Select all
man mv
Last edited by GarryRicketson on 2017-11-08 00:23, edited 1 time in total.
User avatar
GarryRicketson
 
Posts: 4480
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Root user files storage

Postby Segfault » 2017-11-08 00:11

root account is not an user account, it is an admin account.
Segfault
 
Posts: 563
Joined: 2005-09-24 12:24

Re: Root user files storage

Postby GarryRicketson » 2017-11-08 01:50

I thought dumping and writing new partition tables messes up everything and one does it only while installing OS.

It can if you are not experienced and care full, but it can be done with out messing anything up. In any event , you should all ways make a good back up
before doing this, not just for changing partition tables , but any thing that
effects the system. If you make and have a good back up, "messing everything up" is not a problem, you can all ways restore it to the way it was with the back up. If you do not have a good backup made, make one before you start changing partitions, you should make one any way.
Note what is said:
by p.H »You can use sfdisk to change logical partitions into primary partitions. Handle with care.


Here is a screen shot, I made a directory in my /home/garry directory, I named
it "mysecretfiles", the name does not matter, it could be named root if so desired, however as I mentioned earlier, just naming it root, does not make it
owned by root, you need to learn how to set ownership and permissions, etc,
Image

As mentioned by :
Post by Segfault » 2017-11-07 18:11
root account is not an user account, it is an admin account.

It is a really bad idea to be using the /root directory for user files, like you have been.
If you have files that you do not want other to be able to access, that is fine, but you should be doing all of this in your home directory, not root's, ...
Last edited by GarryRicketson on 2017-11-08 09:18, edited 1 time in total.
"What we expect you have already Done"

Before doing anything, read the Debian documentation:
Debian Documentation
How to ask the smart way
Debian Foro Español
======================
For the Birds
User avatar
GarryRicketson
 
Posts: 4480
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Root user files storage

Postby debiman » 2017-11-08 05:09

where's the general-purpose write-up to link to in cases like these?

not sure how to characterize it; cases where a newb decides to do some mid-level stuff instead of staying with mint cinnamon, and takes a fundamentally wrong turn somewhere in the beginning - cases where "of course you can do it like that, but you really shouldn't" should be backed by a linked article?
you know, like the "smart questions" link?
User avatar
debiman
 
Posts: 1636
Joined: 2013-03-12 07:18

Re: Root user files storage

Postby dilberts_left_nut » 2017-11-08 05:37

forneus wrote:After installation I first logged in as root.
I thought that was disabled by default (because it's a bad idea) - what Display Manager and DE are you using? (or did you search up a 'workaround' when it wouldn't let you?).
And /root had all regular folders(Documents, Music, Video..) so I assumed that root account can be used as /home.
You assume wrong. Those are created on first (graphical) login to a DE implementing the xdg specs, which, again, is a bad idea as root.

I let Debian do the partitioning during installation and I did not create any volumes. Now my question is can I store my personal files in, for example, /root/Documents (it already exists). These root folders belong only to a 30GB system volume or they can use my extended file partition (see screen shot above)?

You should just create a second regular user and use that to "hide" your files from yourself.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4706
Joined: 2009-10-05 07:54
Location: enzed

Re: Root user files storage

Postby p.H » 2017-11-08 07:39

forneus wrote:So just to be clear: I create /home/root (while in root account?) and and it's not going to be on a 30G system partition?

It's going to be on the filesystem containing /home/*. If /dev/sda5 is mounted on /home, then /home/root will be on /dev/sda5.
But you'll have to save files somewhere in /home/root explicitly, or replace standard directories in /root with symbolic links pointing to directories in /home/root.

Anyway, as others replied, you should not use the root account for everyday use. Root is for administrative tasks only.

forneus wrote:As for the changing numbering process: I don't need to reinstall Debian again? I thought dumping and writing new partition tables messes up everything and one does it only while installing OS. Does it really matter in terms of performance which numbers are assigned?

No, you do not have to reinstall if you don't mess up.
No, it does not matter at all in terms of performance. IMO, it is not worth it.
p.H
 
Posts: 179
Joined: 2017-09-17 07:12

Next

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable