Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Adrian Sevcenco

On 5/11/20 7:21 PM, Petru Rațiu wrote:

On Mon, May 11, 2020 at 7:16 PM Claudiu N. Cismaru 
wrote:



Si apoi iti iei de acolo ce field vrei... Sorry, Petru, ca am spoiled
solutia :D



Nu intentionam sa fie o "solutie" in sine, ideea de baza e ca daca vrei
ceva care e putin in raspar fata de cum vor sculele pe care le ai la
indemana, de cele mai multe ori e mai bine sa dai un pas inapoi si sa
reformulezi problema pe care o ai in loc sa insisti sa bati cuie cu lopata.

yup asta am si facut :)
problema era asa : am trecut o placa raid areca in mod jbod pentru a 
face raid-ul software.. pentru asta totusi nu e hba (cum mi-a zis si 
supportul lor) nu obtin exact deviceurile ci niste block deviceuri ce 
sunt "translatate" ..
astfel incercam sa listez toate sd-urile din care sa scot sata-urile 
placi de baza mixate pentru ca:

mdadm -D /dev/md0
/dev/md0:

Number   Major   Minor   RaidDevice State
   0  65  1280  active sync   /dev/sdy
   1  65  1601  active sync   /dev/sdaa

dar solutia gasita de mine a fost sa:
find /dev/disk/by-path -name "*scsi*" | sort
si apoi realpath pe fiecare in parte .. avantajul e ca datorita modului 
de functionare (alocare lun-uri) am o oaresce garantie ca ordinea 
corespunde cu sloturile asociate in card/backplane (oricum neavand alta 
modalitate de mapare system<->card)


in caz ca apare intrebarea de ce vreau denumirile cu /dev/sd* e doar de 
convenienta pentru lucrul cu mdadm


Adrian



Sau cum zicea un clasic:
"Q: How can I use X to do Y?
A: If what you want is to do Y, you should ask that question without
pre-supposing the use of a method that may not be appropriate. Questions of
this form often indicate a person who is not merely ignorant about X, but
confused about what problem Y they are solving and too fixated on the
details of their particular situation."





___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Claudiu N. Cismaru
> 
> ls -l /dev/sd{a..z}{,{a..z}} 2>/dev/null | sort -k 5,5 -k 6,6

Actually, you can drop -k 5,5, daca mentii sd*.

-- 
  Claudiu N. Cismaru




___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Petru Rațiu
On Mon, May 11, 2020 at 7:16 PM Claudiu N. Cismaru 
wrote:

>
> Si apoi iti iei de acolo ce field vrei... Sorry, Petru, ca am spoiled
> solutia :D
>
>
Nu intentionam sa fie o "solutie" in sine, ideea de baza e ca daca vrei
ceva care e putin in raspar fata de cum vor sculele pe care le ai la
indemana, de cele mai multe ori e mai bine sa dai un pas inapoi si sa
reformulezi problema pe care o ai in loc sa insisti sa bati cuie cu lopata.

Sau cum zicea un clasic:
"Q: How can I use X to do Y?
A: If what you want is to do Y, you should ask that question without
pre-supposing the use of a method that may not be appropriate. Questions of
this form often indicate a person who is not merely ignorant about X, but
confused about what problem Y they are solving and too fixated on the
details of their particular situation."

-- 
P.
___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Claudiu N. Cismaru
> aha! multumesc de idee! nu ca idee in sine ci ca pot sa fac sortul mai 
> devreme de rezultatul final
> adica:
> find /dev/disk/by-path -name "*scsi*" | sort
> si pe urma pot sa fac realpath pe fiecare entry, asa ca sun ordonate si 
> blockdeviceurile date de placa
> si filtrate (nu am sata-urile locale) (nu e hba, e un raid areca trecut in 
> jbod)

Sau ai putea sa simplifici o gramada, daca ai fi citit cu atentie mailul lui 
Petru... si obtineai one liner genul:

ls -l /dev/sd{a..z}{,{a..z}} 2>/dev/null | sort -k 5,5 -k 6,6

Si apoi iti iei de acolo ce field vrei... Sorry, Petru, ca am spoiled solutia :D

-- 
  Claudiu N. Cismaru




___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Octavian Chelu
On duminică, 10 mai 2020 18:54:16 EEST Adrian Sevcenco wrote:
> Salutare! Are cineva idee cum pot sa fac sort-ul sa imi puna sdaa sdab dupa
> sdz? momentan imi tot da:
> sda
> sdab
> un numare de deviceuri cu 4 litere
> tot restul deviceurilor cu 3 litere
> sdz
> 
> Multumesc!
> Adrian
> 
> ___
> RLUG mailing list
> RLUG@lists.lug.ro
> http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


$ ls /dev/sd* |sort -t '/' --key 3.4,3.4 --key 3.3,3.3 

___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Adrian Sevcenco

On 5/11/20 3:12 PM, Cristian Paslaru wrote:

(fdisk -l 2>/dev/null|grep '^Disk /dev/sd.:'|sort; fdisk -l
2>/dev/null|grep '^Disk /dev/sda.:'|sort)|nl -v0

aha! multumesc de idee! nu ca idee in sine ci ca pot sa fac sortul mai devreme 
de rezultatul final
adica:
find /dev/disk/by-path -name "*scsi*" | sort
si pe urma pot sa fac realpath pe fiecare entry, asa ca sun ordonate si 
blockdeviceurile date de placa
si filtrate (nu am sata-urile locale) (nu e hba, e un raid areca trecut in jbod)

Merci!!
Adrian




  0 Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
  1 Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
  2 Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes
  3 Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes
  4 Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
  5 Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
  6 Disk /dev/sdg: 4000.8 GB, 4000787030016 bytes
  7 Disk /dev/sdh: 2000.4 GB, 2000398934016 bytes
  8 Disk /dev/sdi: 2000.4 GB, 2000398934016 bytes
  9 Disk /dev/sdj: 2000.4 GB, 2000398934016 bytes
 10 Disk /dev/sdl: 2000.4 GB, 2000398934016 bytes
 11 Disk /dev/sdm: 2000.4 GB, 2000398934016 bytes
 12 Disk /dev/sdn: 2000.4 GB, 2000398934016 bytes
 13 Disk /dev/sdo: 2000.4 GB, 2000398934016 bytes
 14 Disk /dev/sdp: 2000.4 GB, 2000398934016 bytes
 15 Disk /dev/sdq: 2000.4 GB, 2000398934016 bytes
 16 Disk /dev/sdr: 2000.4 GB, 2000398934016 bytes
 17 Disk /dev/sds: 2000.4 GB, 2000398934016 bytes
 18 Disk /dev/sdt: 2000.4 GB, 2000398934016 bytes
 19 Disk /dev/sdu: 2000.4 GB, 2000398934016 bytes
 20 Disk /dev/sdv: 2000.4 GB, 2000398934016 bytes
 21 Disk /dev/sdw: 2000.4 GB, 2000398934016 bytes
 22 Disk /dev/sdx: 2000.4 GB, 2000398934016 bytes
 23 Disk /dev/sdy: 2000.4 GB, 2000398934016 bytes
 24 Disk /dev/sdz: 2000.4 GB, 2000398934016 bytes
 25 Disk /dev/sdaa: 2000.4 GB, 2000398934016 bytes
 26 Disk /dev/sdab: 2000.4 GB, 2000398934016 bytes
 27 Disk /dev/sdac: 4000.8 GB, 4000787030016 bytes
 28 Disk /dev/sdad: 2000.4 GB, 2000398934016 bytes
 29 Disk /dev/sdae: 2000.4 GB, 2000398934016 bytes
 30 Disk /dev/sdaf: 2000.4 GB, 2000398934016 bytes
 31 Disk /dev/sdah: 2000.4 GB, 2000398934016 bytes
 32 Disk /dev/sdai: 2000.4 GB, 2000398934016 bytes
 33 Disk /dev/sdaj: 2000.4 GB, 2000398934016 bytes
 34 Disk /dev/sdak: 4000.8 GB, 4000787030016 bytes
 35 Disk /dev/sdal: 2000.4 GB, 2000398934016 bytes

On Sun, May 10, 2020 at 6:56 PM Adrian Sevcenco 
wrote:


Salutare! Are cineva idee cum pot sa fac sort-ul sa imi puna sdaa sdab
dupa sdz?
momentan imi tot da:
sda
sdab
un numare de deviceuri cu 4 litere
tot restul deviceurilor cu 3 litere
sdz

Multumesc!
Adrian

___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro




___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro


Re: [rlug] sort :: sdaa dupa sdz

2020-05-11 Fir de Conversatie Cristian Paslaru
(fdisk -l 2>/dev/null|grep '^Disk /dev/sd.:'|sort; fdisk -l
2>/dev/null|grep '^Disk /dev/sda.:'|sort)|nl -v0
 0 Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
 1 Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
 2 Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes
 3 Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes
 4 Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
 5 Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
 6 Disk /dev/sdg: 4000.8 GB, 4000787030016 bytes
 7 Disk /dev/sdh: 2000.4 GB, 2000398934016 bytes
 8 Disk /dev/sdi: 2000.4 GB, 2000398934016 bytes
 9 Disk /dev/sdj: 2000.4 GB, 2000398934016 bytes
10 Disk /dev/sdl: 2000.4 GB, 2000398934016 bytes
11 Disk /dev/sdm: 2000.4 GB, 2000398934016 bytes
12 Disk /dev/sdn: 2000.4 GB, 2000398934016 bytes
13 Disk /dev/sdo: 2000.4 GB, 2000398934016 bytes
14 Disk /dev/sdp: 2000.4 GB, 2000398934016 bytes
15 Disk /dev/sdq: 2000.4 GB, 2000398934016 bytes
16 Disk /dev/sdr: 2000.4 GB, 2000398934016 bytes
17 Disk /dev/sds: 2000.4 GB, 2000398934016 bytes
18 Disk /dev/sdt: 2000.4 GB, 2000398934016 bytes
19 Disk /dev/sdu: 2000.4 GB, 2000398934016 bytes
20 Disk /dev/sdv: 2000.4 GB, 2000398934016 bytes
21 Disk /dev/sdw: 2000.4 GB, 2000398934016 bytes
22 Disk /dev/sdx: 2000.4 GB, 2000398934016 bytes
23 Disk /dev/sdy: 2000.4 GB, 2000398934016 bytes
24 Disk /dev/sdz: 2000.4 GB, 2000398934016 bytes
25 Disk /dev/sdaa: 2000.4 GB, 2000398934016 bytes
26 Disk /dev/sdab: 2000.4 GB, 2000398934016 bytes
27 Disk /dev/sdac: 4000.8 GB, 4000787030016 bytes
28 Disk /dev/sdad: 2000.4 GB, 2000398934016 bytes
29 Disk /dev/sdae: 2000.4 GB, 2000398934016 bytes
30 Disk /dev/sdaf: 2000.4 GB, 2000398934016 bytes
31 Disk /dev/sdah: 2000.4 GB, 2000398934016 bytes
32 Disk /dev/sdai: 2000.4 GB, 2000398934016 bytes
33 Disk /dev/sdaj: 2000.4 GB, 2000398934016 bytes
34 Disk /dev/sdak: 4000.8 GB, 4000787030016 bytes
35 Disk /dev/sdal: 2000.4 GB, 2000398934016 bytes

On Sun, May 10, 2020 at 6:56 PM Adrian Sevcenco 
wrote:

> Salutare! Are cineva idee cum pot sa fac sort-ul sa imi puna sdaa sdab
> dupa sdz?
> momentan imi tot da:
> sda
> sdab
> un numare de deviceuri cu 4 litere
> tot restul deviceurilor cu 3 litere
> sdz
>
> Multumesc!
> Adrian
>
> ___
> RLUG mailing list
> RLUG@lists.lug.ro
> http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro
>
___
RLUG mailing list
RLUG@lists.lug.ro
http://lists.lug.ro/mailman/listinfo/rlug_lists.lug.ro