Re: [gentoo-user] Gparted leaves gaps

2021-04-01 Thread Michael
On Thursday, 1 April 2021 16:06:37 BST Peter Humphrey wrote:
> On Thursday, 1 April 2021 11:13:07 BST Michael wrote:
> > You could check/set the alignment of logical-physical sectors yourself, by
> > making sure the start of your partitions is divisible by 8, instead of
> > adopting the GParted 1MB default boundary in any cases where it is not
> > necessary.
> 
> So it seems to be the partition start points that matter; sizes have nothing
> to do with it. Makes sense, now I think about it.

Yes, it is the starting point which determines the first 512 byte logical 
sector and those what follow it, are aligned with the first 4096 byte physical 
sector and those that follow it.

When these are not aligned a write operation instructed by software could 
straddle more than one physical sector, even when the data to be stored is 
less than 4096B.  This results in moving, deleting, writing more sectors and 
data than necessary, a measurably inefficient process.  This is noticeable on 
spinning drive benchmarks and can get much worse on flash and SSDs with their 
coarser erase Vs write pages (a.k.a. write amplification).


> I've just realigned all my partitions to accord with that insight. It turned
> out that most of them had small differences from 8^n sizes and start
> points, which would explain all those unpartitioned spaces.
> 
> All well now. Thanks all.

I recall fighting against gparted's optimal alignment myself when partitioning 
tools first started catering for 4K size sectors, only having to realign my 
partitions as soon as I realised the error of my ways!  ;-)


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] Gparted leaves gaps

2021-04-01 Thread Peter Humphrey
On Thursday, 1 April 2021 11:13:07 BST Michael wrote:

> You could check/set the alignment of logical-physical sectors yourself, by
> making sure the start of your partitions is divisible by 8, instead of
> adopting the GParted 1MB default boundary in any cases where it is not
> necessary.

So it seems to be the partition start points that matter; sizes have nothing 
to do with it. Makes sense, now I think about it.

I've just realigned all my partitions to accord with that insight. It turned 
out that most of them had small differences from 8^n sizes and start points, 
which would explain all those unpartitioned spaces.

All well now. Thanks all.

-- 
Regards,
Peter.






Re: [gentoo-user] Disable password required to mount removable hard disk. (solved)

2021-04-01 Thread Ramon Fischer

Awesome!

I am glad to hear, that I could help. :)

-Ramon

On 01/04/2021 13:28, William Kenworthy wrote:

In the end it was easy: created a polkit rule enabling users in the
wheel group to not use a password.

rattus ~ # cat /etc/polkit-1/rules.d/55-disks.rules

// Allow any user in the 'wheel' group to mount a disk
// without entering a password.

polkit.addRule(function(action, subject) {
     if (action.id == "org.freedesktop.udisks2.filesystem-mount-system" &&
     subject.isInGroup("wheel")) 

{

     return polkit.Result.YES;
     }
});
rattus ~ #

Thanks for the polkit hint.

BillK


On 1/4/21 6:08 pm, William Kenworthy wrote:

Hi, I only have a default polkit rule - nothing about usb.

Just noticed the mount dialog box contains:

Action: org.freedesktop.udisks2.filesystem-mount-system

Vendor: The Udsks Project"

I have found some documents on the web, but nothing yet on how to deal
with this issue.

BillK


On 1/4/21 3:21 pm, Ramon Fischer wrote:

Addendum:

I forgot to answer your other question:

Maybe you also have set some rules in "/etc/polkit/rules.d/"[1], which
allows your unprivileged user to mount USB drives and SD cards without
any password.

-Ramon

[1] https://wiki.gentoo.org/wiki/Polkit

On 01/04/2021 09:13, Ramon Fischer wrote:

Hello BillK,

I guess, that you are looking for the mount option "user":

    /etc/fstab

    /dev/sdx     /   ext4 noauto,user,relatime
0   2

In this way, I can mount "/dev/sdx" with an unprivileged user:

    $ mount /

See also "man 8 mount" ("Non-superuser mounts").

I am not sure, if this also works with "automount" from
"net-fs/autofs", if this is what you meant with "automounter".

-Ramon

On 01/04/2021 06:51, William Kenworthy wrote:

Hi,

   I use a sata drive caddy with 2Tb hard disks for offline backups.
Almost everytime (within sessions are ok?) it asks for a password
before
automounting.  This is just annoying and has no security benefit in my
environment (why just hard disks when USB keys and SD cards don't ask
for one?).

So, how can I disable the automounter asking for a password either in
general, or just for my backup drives?

BillK





--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF




OpenPGP_signature
Description: OpenPGP digital signature


Re: [gentoo-user] Disable password required to mount removable hard disk. (solved)

2021-04-01 Thread William Kenworthy
In the end it was easy: created a polkit rule enabling users in the
wheel group to not use a password.

rattus ~ # cat /etc/polkit-1/rules.d/55-disks.rules

// Allow any user in the 'wheel' group to mount a disk
// without entering a password.

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.udisks2.filesystem-mount-system" &&
    subject.isInGroup("wheel")) {
    return polkit.Result.YES;
    }
});
rattus ~ #

Thanks for the polkit hint.

BillK


On 1/4/21 6:08 pm, William Kenworthy wrote:
> Hi, I only have a default polkit rule - nothing about usb.
>
> Just noticed the mount dialog box contains:
>
> Action: org.freedesktop.udisks2.filesystem-mount-system
>
> Vendor: The Udsks Project"
>
> I have found some documents on the web, but nothing yet on how to deal
> with this issue.
>
> BillK
>
>
> On 1/4/21 3:21 pm, Ramon Fischer wrote:
>> Addendum:
>>
>> I forgot to answer your other question:
>>
>> Maybe you also have set some rules in "/etc/polkit/rules.d/"[1], which
>> allows your unprivileged user to mount USB drives and SD cards without
>> any password.
>>
>> -Ramon
>>
>> [1] https://wiki.gentoo.org/wiki/Polkit
>>
>> On 01/04/2021 09:13, Ramon Fischer wrote:
>>> Hello BillK,
>>>
>>> I guess, that you are looking for the mount option "user":
>>>
>>>    /etc/fstab
>>>
>>>    /dev/sdx     /   ext4 noauto,user,relatime
>>> 0   2
>>>
>>> In this way, I can mount "/dev/sdx" with an unprivileged user:
>>>
>>>    $ mount /
>>>
>>> See also "man 8 mount" ("Non-superuser mounts").
>>>
>>> I am not sure, if this also works with "automount" from
>>> "net-fs/autofs", if this is what you meant with "automounter".
>>>
>>> -Ramon
>>>
>>> On 01/04/2021 06:51, William Kenworthy wrote:
 Hi,

   I use a sata drive caddy with 2Tb hard disks for offline backups.
 Almost everytime (within sessions are ok?) it asks for a password
 before
 automounting.  This is just annoying and has no security benefit in my
 environment (why just hard disks when USB keys and SD cards don't ask
 for one?).

 So, how can I disable the automounter asking for a password either in
 general, or just for my backup drives?

 BillK






Re: [gentoo-user] Gparted leaves gaps

2021-04-01 Thread Michael
On Thursday, 1 April 2021 03:04:31 BST William Kenworthy wrote:
> On 1/4/21 12:39 am, Peter Humphrey wrote:
> > Hello list,
> > 
> > I use gparted often, usually from SystemRescueCD, and a common task is to
> > move partitions to allow for one to be enlarged. I should be able to
> > specify all the operations in a list, but whenever I do that gparted
> > inserts 1MB gaps between partitions, so I have to do one at a time. Even
> > the latest bootable gparted CD image does the same.
> > 
> > Can anyone tell me what causes this? Has it anything to do with my always
> > specifying partition size as a power of 8? (I'm of the old school, having
> > been sent on my first computer hardware course in 1972.)
> 
> Forcing alignment on megabyte boundaries? - I cant find a reason, but I
> think I read in the past it was for efficiency with modern file systems.
> 
> BillK

Yes, 4K physical sector size and partition alignment, ubiquitous on modern 
'Advanced Format' drives, is used by all partitioning tools these days.

There are many references in the interwebs, but in summary modern AF spinning 
drives have 4096 byte physical sector size with a 512 byte logical sector 
size.  To ensure alignment you could start a partition at an LBA divisible by 
8, but since Microsoft came out with Vista's partition manager a convention of 
1MB has been set as the starting point:

512 * 2048 = 1,048,576

The 1MB (2048 logical sectors) convention for the start of a partition is used 
to cater for various hardware and partitioning requirements, inc. different 
RAID data stripe sizes, SSDs with different erase block sizes, etc.  It 
ensures logical-physical partition alignment to optimise performance when 
delete/write operations take place and as long as you are not trying to 
squeeze the very last ounce of usable space out of your terabytes of storage, 
it achieves its stated aim.

Parted has 3 options for aligning the start of a partition: none, minimal and 
optimal.  With 'none' it will start a partition wherever you ask it, without 
paying heed to logical-to-physical sector alignment.  With 'minimal' it will 
shift the start/end of a partition to make sure the minimum alignment between 
logical and physical sectors is achieved.  With 'optimal' it will check if the 
partition is aligned to a multiple of the physical block size.  'Optimal' is 
the default.  You could check/set the alignment of logical-physical sectors 
yourself, by making sure the start of your partitions is divisible by 8, 
instead of adopting the GParted 1MB default boundary in any cases where it is 
not necessary.

signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] Disable password required to mount removable hard disk.

2021-04-01 Thread William Kenworthy
Hi, I only have a default polkit rule - nothing about usb.

Just noticed the mount dialog box contains:

Action: org.freedesktop.udisks2.filesystem-mount-system

Vendor: The Udsks Project"

I have found some documents on the web, but nothing yet on how to deal
with this issue.

BillK


On 1/4/21 3:21 pm, Ramon Fischer wrote:
> Addendum:
>
> I forgot to answer your other question:
>
> Maybe you also have set some rules in "/etc/polkit/rules.d/"[1], which
> allows your unprivileged user to mount USB drives and SD cards without
> any password.
>
> -Ramon
>
> [1] https://wiki.gentoo.org/wiki/Polkit
>
> On 01/04/2021 09:13, Ramon Fischer wrote:
>> Hello BillK,
>>
>> I guess, that you are looking for the mount option "user":
>>
>>    /etc/fstab
>>
>>    /dev/sdx     /   ext4 noauto,user,relatime
>> 0   2
>>
>> In this way, I can mount "/dev/sdx" with an unprivileged user:
>>
>>    $ mount /
>>
>> See also "man 8 mount" ("Non-superuser mounts").
>>
>> I am not sure, if this also works with "automount" from
>> "net-fs/autofs", if this is what you meant with "automounter".
>>
>> -Ramon
>>
>> On 01/04/2021 06:51, William Kenworthy wrote:
>>> Hi,
>>>
>>>   I use a sata drive caddy with 2Tb hard disks for offline backups.
>>> Almost everytime (within sessions are ok?) it asks for a password
>>> before
>>> automounting.  This is just annoying and has no security benefit in my
>>> environment (why just hard disks when USB keys and SD cards don't ask
>>> for one?).
>>>
>>> So, how can I disable the automounter asking for a password either in
>>> general, or just for my backup drives?
>>>
>>> BillK
>>>
>>>
>>>
>>
>



Re: [gentoo-user] Disable password required to mount removable hard disk.

2021-04-01 Thread William Kenworthy
I have used fstab in the past -its more a workaround that breaks (i.e, a
disk usually, but not always appears as /dev/sde, and while I currently
use btrfs I also use xfs on some portable drives.)

I mean automounting of disks (pam/polkit/udsiks2 seem to be involved),
not autofs in this case

BillK


On 1/4/21 3:13 pm, Ramon Fischer wrote:
> Hello BillK,
>
> I guess, that you are looking for the mount option "user":
>
>    /etc/fstab
>
>    /dev/sdx     /   ext4 noauto,user,relatime
> 0   2
>
> In this way, I can mount "/dev/sdx" with an unprivileged user:
>
>    $ mount /
>
> See also "man 8 mount" ("Non-superuser mounts").
>
> I am not sure, if this also works with "automount" from
> "net-fs/autofs", if this is what you meant with "automounter".
>
> -Ramon
>
> On 01/04/2021 06:51, William Kenworthy wrote:
>> Hi,
>>
>>   I use a sata drive caddy with 2Tb hard disks for offline backups.
>> Almost everytime (within sessions are ok?) it asks for a password before
>> automounting.  This is just annoying and has no security benefit in my
>> environment (why just hard disks when USB keys and SD cards don't ask
>> for one?).
>>
>> So, how can I disable the automounter asking for a password either in
>> general, or just for my backup drives?
>>
>> BillK
>>
>>
>>
>



Re: [gentoo-user] Disable password required to mount removable hard disk.

2021-04-01 Thread Ramon Fischer

Addendum:

I forgot to answer your other question:

Maybe you also have set some rules in "/etc/polkit/rules.d/"[1], which 
allows your unprivileged user to mount USB drives and SD cards without 
any password.


-Ramon

[1] https://wiki.gentoo.org/wiki/Polkit

On 01/04/2021 09:13, Ramon Fischer wrote:

Hello BillK,

I guess, that you are looking for the mount option "user":

   /etc/fstab

   /dev/sdx     /   ext4 noauto,user,relatime 
0   2


In this way, I can mount "/dev/sdx" with an unprivileged user:

   $ mount /

See also "man 8 mount" ("Non-superuser mounts").

I am not sure, if this also works with "automount" from 
"net-fs/autofs", if this is what you meant with "automounter".


-Ramon

On 01/04/2021 06:51, William Kenworthy wrote:

Hi,

  I use a sata drive caddy with 2Tb hard disks for offline backups.
Almost everytime (within sessions are ok?) it asks for a password before
automounting.  This is just annoying and has no security benefit in my
environment (why just hard disks when USB keys and SD cards don't ask
for one?).

So, how can I disable the automounter asking for a password either in
general, or just for my backup drives?

BillK







--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF




OpenPGP_signature
Description: OpenPGP digital signature


Re: [gentoo-user] Disable password required to mount removable hard disk.

2021-04-01 Thread Ramon Fischer

Hello BillK,

I guess, that you are looking for the mount option "user":

   /etc/fstab

   /dev/sdx     /   ext4 noauto,user,relatime 0   2

In this way, I can mount "/dev/sdx" with an unprivileged user:

   $ mount /

See also "man 8 mount" ("Non-superuser mounts").

I am not sure, if this also works with "automount" from "net-fs/autofs", 
if this is what you meant with "automounter".


-Ramon

On 01/04/2021 06:51, William Kenworthy wrote:

Hi,

  I use a sata drive caddy with 2Tb hard disks for offline backups.
Almost everytime (within sessions are ok?) it asks for a password before
automounting.  This is just annoying and has no security benefit in my
environment (why just hard disks when USB keys and SD cards don't ask
for one?).

So, how can I disable the automounter asking for a password either in
general, or just for my backup drives?

BillK





--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF




OpenPGP_signature
Description: OpenPGP digital signature