Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Root user files storage

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
forneus
Posts: 6
Joined: 2017-11-07 20:01

Root user files storage

#1 Post by forneus »

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
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 86 times

Re: Root user files storage

#2 Post by 4D696B65 »

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
forneus
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

#3 Post by forneus »

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
RU55EL
Posts: 546
Joined: 2014-04-07 03:42
Location: /home/russel

Re: Root user files storage

#4 Post by RU55EL »

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
forneus
Posts: 6
Joined: 2017-11-07 20:01

Re: Root user files storage

#5 Post by forneus »

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

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Root user files storage

#6 Post by p.H »

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.

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

Re: Root user files storage

#7 Post by forneus »

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?

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Root user files storage

#8 Post by Segfault »

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.

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

Re: Root user files storage

#9 Post by forneus »

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
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Root user files storage

#10 Post by GarryRicketson »

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.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Root user files storage

#11 Post by Segfault »

root account is not an user account, it is an admin account.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Root user files storage

#12 Post by GarryRicketson »

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.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Root user files storage

#13 Post by debiman »

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
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 13 times
Been thanked: 66 times

Re: Root user files storage

#14 Post by dilberts_left_nut »

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...

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Root user files storage

#15 Post by p.H »

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.

nnm
Posts: 16
Joined: 2017-10-07 10:11
Location: /dev/zero

Re: Root user files storage

#16 Post by nnm »

You can always rbind a directory to another file system on another drive.
Debian 9 (Stretch)
Asus Vivobook S551LB

Post Reply