non sudo parted -l equivalent

Message
Author
User avatar
Buck Fankers
Posts: 744
Joined: Sat Mar 10, 2018 9:06 pm

non sudo parted -l equivalent

#1 Post by Buck Fankers »

I hope this is OK forum for this somehow OT subject.

This command:
sudo parted -l | grep "Partition Table: "
returns type of partition table 'msdos' or 'gpt'. Is there equivalent command I can use that does not need 'sudo' privileged rights?

I would like to use it in my script with a combination with:
test -d /sys/firmware/efi && echo UEFI || echo BIOS
to determine if OS installation matches hardware (BIOS+msdos or UEFI+gpt)

And there is just bad karma if your code is requesting a password ;-)

User avatar
dolphin_oracle
Developer
Posts: 20032
Joined: Sun Dec 16, 2007 1:17 pm

Re: non sudo parted -l equivalent

#2 Post by dolphin_oracle »

Code: Select all

udevadm info /dev/sda
give all sort of stuff, including partition table type for block devices.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
oops
Posts: 1620
Joined: Tue Apr 10, 2018 5:07 pm

Re: non sudo parted -l equivalent

#3 Post by oops »

Or:

Code: Select all

inxi -Dxxx | grep scheme
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

User avatar
fehlix
Developer
Posts: 10383
Joined: Wed Apr 11, 2018 5:09 pm

Re: non sudo parted -l equivalent

#4 Post by fehlix »

Buck Fankers wrote: Sun Nov 11, 2018 12:26 pm This command:
sudo parted -l | grep "Partition Table: "
returns type of partition table 'msdos' or 'gpt'. Is there equivalent command I can use that does not need 'sudo' privileged rights?
This:

Code: Select all

udevadm info -q property /dev/sda | sed -n s/ID_PART_TABLE_TYPE=//p
would print either gpt or dos for /dev/sda .
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
Buck Fankers
Posts: 744
Joined: Sat Mar 10, 2018 9:06 pm

Re: non sudo parted -l equivalent

#5 Post by Buck Fankers »

fehlix wrote: Sun Nov 11, 2018 2:42 pm This:

Code: Select all

udevadm info -q property /dev/sda | sed -n s/ID_PART_TABLE_TYPE=//p
would print either gpt or dos for /dev/sda .
Perfect, thank you very much!

User avatar
Buck Fankers
Posts: 744
Joined: Sat Mar 10, 2018 9:06 pm

Re: non sudo parted -l equivalent

#6 Post by Buck Fankers »

dolphin_oracle wrote: Sun Nov 11, 2018 1:26 pm

Code: Select all

udevadm info /dev/sda
give all sort of stuff, including partition table type for block devices.
For some reason I initially only saw one answer.
Will try yours also & thanks

User avatar
Buck Fankers
Posts: 744
Joined: Sat Mar 10, 2018 9:06 pm

Re: non sudo parted -l equivalent

#7 Post by Buck Fankers »

oops wrote: Sun Nov 11, 2018 1:32 pm Or:

Code: Select all

inxi -Dxxx | grep scheme
Oh, it's also there?
Thanks!

User avatar
oops
Posts: 1620
Joined: Tue Apr 10, 2018 5:07 pm

Re: non sudo parted -l equivalent

#8 Post by oops »

Buck Fankers wrote: Thu Nov 15, 2018 8:12 pm
oops wrote: Sun Nov 11, 2018 1:32 pm Or:

Code: Select all

inxi -Dxxx | grep scheme
Oh, it's also there?
Thanks!
Hi,
Yes,here: GPT - UEFI

Code: Select all

$ inxi -Dxxx | grep scheme | sed '/.*scheme:/ s/.*scheme:\ //g'
GPT 
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

User avatar
Buck Fankers
Posts: 744
Joined: Sat Mar 10, 2018 9:06 pm

Re: non sudo parted -l equivalent

#9 Post by Buck Fankers »

This Inxi is really nicely evolving and growing it has everything! :-)

User avatar
oops
Posts: 1620
Joined: Tue Apr 10, 2018 5:07 pm

Re: non sudo parted -l equivalent

#10 Post by oops »

Buck Fankers wrote: Fri Nov 16, 2018 8:22 am This Inxi is really nicely evolving and growing it has everything! :-)
Right, almost.
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

Post Reply

Return to “General”