Web lists-archives.com

Re: Permission issues - operator error?




On 9/23/18 11:18 AM, Richard Owlett wrote:
Is this not creating a partition?
root@debian8-6:/home/richard# mkfs.ext4 root_owner=1000:1000 -L 2018Sept23tst1 /dev/sdb1

No. The "mkfs.ext4" command creates a file system on a pre-existing device or partition (e.g. /dev/sdb1).


I want to use CLI to take a USB connected drive from a known state
[i.e. dd if=/dev/zero ...] to an ext4 partitioned device

I use dd(1) to erase devices, as you already did. Erasing the first megabyte and the last megabyte should meet your needs.


I use parted(8) to create partition tables and to create partitions. Creating an MS-DOS partition table and creating one primary partition using 100% of the available space should meet your needs.


I use mkfs(8) (or a file system-specific sub-command) to create file systems, as you already tried. 'man mkfs.ext' redirects to mke2fs(8); that should meet your needs.


After you have done the above steps, you will need to create a mount point using mkdir(1), and then mount the file system using mount(8).


which presents itself as owned by 'richard' of group 'richard'.

Once the file system is mounted, it may or may not be possible to change the owner and group using chown(1). (I typically create a sub-directory named after the user, and change the owner and group of that sub-directory.)


David