The officially official Devuan Forum!

You are not logged in.

#1 2021-12-22 21:04:35

nobodyuknow
Member
Registered: 2017-09-10
Posts: 173  

[SOLVED] create new partition table on HDD, but not with root as owner

Up until now, I've always created partition tables and partitions on Windows. I'm trying to wean myself off Windows, so I thought I'd create a data HDD via Linux. But regardless of how I create it -- GParted, fdisk, mkfs -- I always end up with a partition that is exclusively owned by root. I've tried chown,which appears to work, but then I still cannot copy files onto the HDD. I'm missing something. Any hints?

Last edited by nobodyuknow (2021-12-22 21:05:08)

Offline

#2 2021-12-22 21:38:57

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] create new partition table on HDD, but not with root as owner

Ownership is defined by the mount point and the filesystem rather than the partition table or the partition itself.

What do you actually want to do with this drive? How are you mounting the device?

nobodyuknow wrote:

I've tried chown,which appears to work, but then I still cannot copy files onto the HDD.

Please post exact commands and error messages rather than vague descriptions.

*Do not* use chown on /dev/sdXY, that is a really bad idea.


Brianna Ghey — Rest In Power

Offline

#3 2021-12-22 21:59:24

golinux
Administrator
Registered: 2016-11-25
Posts: 3,137  

Re: [SOLVED] create new partition table on HDD, but not with root as owner

Note to nobodyuknow . . . I still struggle and get confused when I try to do what you're trying to do.

Online

#4 2021-12-23 00:16:30

nobodyuknow
Member
Registered: 2017-09-10
Posts: 173  

Re: [SOLVED] create new partition table on HDD, but not with root as owner

@golinux

Uh, oh, if the moderator has trouble doing it, it's not trivial.

@Head_on_a_Stick

Your use of the word mount confuses me. I don't want to mount it when I use it; I want to simply connect it via USB and access it, like I do with HDDs I create in Windows. Accessing an NTFS HDD in Linux is obscene, with CPU approaching 100% simply for writing to the drive. I figured that creating an EXT4 HDD would be more efficient.

Here's my sequence of commands for a 500 GB HDD:

sudo shred -vn 1 /dev/sda

use GParted to create an ms-dos partition table and single EXT4 partition.

Try to copy a directory to the newly formatted HDD.

I have screenshots of Gparted and failed copy, but I have no idea how to attach them, as there does not appear to be a way to do that, The text of the error message is "The folder <somename> cannot be copied because you do not have permissions to create it in the destination."

I guess I'll just live with the obscene access via NTFS.

Last edited by nobodyuknow (2021-12-23 01:03:16)

Offline

#5 2021-12-23 09:22:56

hevidevi
Member
Registered: 2021-09-17
Posts: 230  

Re: [SOLVED] create new partition table on HDD, but not with root as owner

how are you mounting/connecting the ntfs data? Through devuan or windows?

By mount, hoas means that the device is connected and mounted read write, usually partitions are created by root and can be accessed by the user so long as the permissions are correct, so this applies to the EXT4 data filesystem, so we want to know how you are connecting and mounting this also.

mount = mount a filesystem

https://linux.die.net/man/8/mount

Last edited by hevidevi (2021-12-23 09:25:00)

Offline

#6 2021-12-23 10:59:31

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] create new partition table on HDD, but not with root as owner

@OP: please don't mark the thread [SOLVED] before I've given the solution. It could be frustrating for others who have the same problem.

I'm presuming you're using some sort of graphical file manager to attempt to access the device and since most of those use GVFS I also presume that the device is mounted under /media/$username where $username is your actual username.

That being the case insert the device then run this command:

sudo chown "$USER":"$USER" /media/"$USER"/*

That should change the filesystem permissions and allow you to drag-and-drop files to the device.


Brianna Ghey — Rest In Power

Offline

#7 2021-12-23 18:14:38

nobodyuknow
Member
Registered: 2017-09-10
Posts: 173  

Re: [SOLVED] create new partition table on HDD, but not with root as owner

I vaguely understand the concept of mount, but I don't think I've ever used it in Linux (I probably used it in Unix a million years ago). Here's what I always do with an HDD I formatted in Windows: I insert the USB cable into my laptop; a nemo (this is Cinnamon) file manager pops up; I access the files on it.

I have another HDD I need to format. I will try HOAS's chown command.

Offline

#8 2021-12-23 21:22:44

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] create new partition table on HDD, but not with root as owner

NTFS doesn't use Linux-style permissions unless you configure it specifically, which would explain why you are able to write to drives formatted from Windows.

Linux has recently (5.15) had a native NTFS kernel driver added so FUSE is no longer needed and performance is much improved. Liquorix offers a Debian stable compatible kernel of that version that could be used with Devuan.


Brianna Ghey — Rest In Power

Offline

#9 2021-12-23 22:24:52

nobodyuknow
Member
Registered: 2017-09-10
Posts: 173  

Re: [SOLVED] create new partition table on HDD, but not with root as owner

I tried the chown command HOAS suggested, but it didn't work, complaining that there was nothing in /media/"$USER"/ and it was correct, there was nothing there even though the HDD was running and connected vis USB.

Then I tried the same trick on a USB flash drive. It had some strange stuff on it from Windows, so I formatted the drive using gnome-disk-utility and created a partition table & partitioned to FAT32 using GParted -- and I can copy files to it. And there's a directory in /media/"$USER"/ with the new name of the USB flash drive. There's something about EXT4.

Offline

#10 2021-12-23 22:45:28

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] create new partition table on HDD, but not with root as owner

nobodyuknow wrote:

complaining that there was nothing in /media/"$USER"/ and it was correct, there was nothing there even though the HDD was running and connected vis USB.

So GVFS isn't acting on the device then. Or it's mounting it somewhere else — use findmnt /dev/sdX to see if it's mounted anywhere.

You could try mounting it manually to change the filesystem permissions:

mkdir ~/storage
sudo mount /dev/sdXY ~/storage
sudo chown -R "$USER":"$USER" ~/storage
sudo umount ~/storage
rmdir ~/storage
nobodyuknow wrote:

partitioned to FAT32

FAT doesn't allow permissions so anybody can do anything to it, unlike ext4. But it has a 4GiB file size limit and it's pretty fragile so I wouldn't really recommend it for general use.


Brianna Ghey — Rest In Power

Offline

Board footer