* How to create new file in idmapped mountpoint
@ 2024-06-14 7:09 Hongbo Li
2024-06-17 7:53 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Hongbo Li @ 2024-06-14 7:09 UTC (permalink / raw)
To: linux-ext4, linux-fsdevel
Hi everyone !
How can I create new file in idmapped mountpoint in ext4?
I try to do the following test:
```
losetup /dev/loop1 ext4.img
mkfs.ext4 /dev/loop1
mount /dev/loop1 /mnt/ext4
./mount-idmapped --map-mount b:0:1001:1 /mnt/ext4 /mnt/idmapped1
cp testfile /mnt/idmapped1
```
then it rebacks me:
```
cp: cannot create regular file '/mnt/idmapped1/testfile': Value too
large for defined data type
```
Did I use it incorrectly?
Thanks,
Hongbo.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to create new file in idmapped mountpoint
2024-06-14 7:09 How to create new file in idmapped mountpoint Hongbo Li
@ 2024-06-17 7:53 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2024-06-17 7:53 UTC (permalink / raw)
To: Hongbo Li; +Cc: linux-ext4, linux-fsdevel
On Fri, Jun 14, 2024 at 03:09:22PM GMT, Hongbo Li wrote:
> Hi everyone !
>
> How can I create new file in idmapped mountpoint in ext4?
>
> I try to do the following test:
> ```
> losetup /dev/loop1 ext4.img
> mkfs.ext4 /dev/loop1
> mount /dev/loop1 /mnt/ext4
> ./mount-idmapped --map-mount b:0:1001:1 /mnt/ext4 /mnt/idmapped1
> cp testfile /mnt/idmapped1
> ```
> then it rebacks me:
> ```
> cp: cannot create regular file '/mnt/idmapped1/testfile': Value too large
> for defined data type
> ```
> Did I use it incorrectly?
You're setting up a mount in which uid 1001 maps to uid 0. So if you
create files as uid 1001 they will map to uid 0 on-disk.
But you haven't mapped uid 0 to anything so the mount doesn't allow the
root user to create files. In order to that you could e.g., do:
sudo mount --bind -o X-mount.idmap='0:1001:1 1001:0:1' /mnt/ex4/ /mnt/idmapped1/
If you now (as root) do cp testfile /mnt/idmapped1/ it will work and
files created by root will show up as being owned by uid 1001 on disk.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-17 7:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 7:09 How to create new file in idmapped mountpoint Hongbo Li
2024-06-17 7:53 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).