In my WSL2 Debian distro, I created an image file named VirtDisk.img
and set it as a virtual block device:
dd if=/dev/zero of=VirtBlock.img bs=1G count=16
16+0 records in
16+0 records out
17179869184 bytes (17 GB, 16 GiB) copied, 11.204 s, 1.5 GB/s
sudo losetup -f -P VirtDisk.img
And then partitioned it intto three parts as below and make a filesystem to them as marked with []
:
sudo fdisk /dev/loop0
Command (m for help): p
Disk /dev/loop0: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x30f503f9
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 2048 1050623 1048576 512M ef EFI (FAT-12/16/32) [FAT32]
/dev/loop0p2 1050624 5244927 4194304 2G 82 Linux swap / Solaris [swap]
/dev/loop0p3 5244928 33554431 28309504 13.5G 83 Linux [EXT4]
Then I mounted the /dev/loop0p1
to ~/mnt
dirctory, and use chown
to change the owner of the mount dir.
But it get an "Operation not permitted" error although I used sudo
as prefix.
sudo mount /dev/loop0p1 mnt
sudo chown colorglass mnt
chown: changing ownership of 'mnt': Operation not permitted
And when I changed to root
to perform the same op, it still gave the same result.
And I the date attribute of the ~/mnt
dir became Jan 1 1970
.
ll
drwxr-xr-x 2 root root 4.0K Jan 1 1970 mnt
Did I made any wrong operations?