Home > Centos, Debian, Linux, Ubuntu > Elencare i dispositivi di memorizzazione collegati a un pc in Linux

Elencare i dispositivi di memorizzazione collegati a un pc in Linux

Per elencare da terminale i dispositivi di memorizzazione collegati ad pc Linux quali: hard disk, penne SB, card SD, etc si possono utilizzare i seguenti comandi o elenchi: /proc/partitions , lsblk, blkid oppure il comando fdisk.

1) cat /proc/partitions

:~$ cat /proc/partitions
major minor  #blocks  name

   8        0 1953514584 sda
   8        1   39070720 sda1
   8        2   30630912 sda2
   8        3   48978944 sda3
   8        4          1 sda4
   8        5  502744064 sda5
   8        6  828664832 sda6
   8        7  284903424 sda7
   8        8  218515456 sda8
  11        0    1048575 sr0
   8       32    7847936 sdc
   8       33    5492736 sdc1
   8       34    2354176 sdc2

2) blkid

 
:~$ sudo blkid
/dev/sda2: LABEL="Srv2" UUID="94b11f2a-d165-42c6-a480-f14ff730a6a6" TYPE="ext4" 
/dev/sda3: LABEL="Srv3" UUID="2185621c-420b-4d21-8b49-3ef4aec85b6e" TYPE="ext4" 
/dev/sda5: LABEL="VM" UUID="1a7d707e-8845-47c1-af40-415a9101294c" TYPE="ext4" 
/dev/sda6: LABEL="Biblioteca" UUID="e76beb7e-a4cd-4cfd-aabb-a79c93752a53" TYPE="ext4" 
/dev/sda7: LABEL="Dati-Home" UUID="688ecf91-3263-4dbb-8050-94151efefdb1" TYPE="ext4" 
/dev/sda8: LABEL="Backup" UUID="632cdd72-cdf8-4386-9b7c-d5679adf5342" TYPE="ext4" 
/dev/sda1: UUID="905c7def-adfd-4904-8c22-b29761e37d3f" TYPE="ext4" 
/dev/sdc1: UUID="40b3b70c-c013-4518-b426-df31711fad71" TYPE="ext3" 
/dev/sdc2: UUID="0a6a1118-b4c4-41aa-8b48-412fb3bac216" TYPE="ext2"

3) lsblk

:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   1,8T  0 disk 
├─sda1   8:1    0  37,3G  0 part /
├─sda2   8:2    0  29,2G  0 part 
├─sda3   8:3    0  46,7G  0 part /mnt/sda3
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0 479,5G  0 part /media/VM
├─sda6   8:6    0 790,3G  0 part /media/Biblioteca
├─sda7   8:7    0 271,7G  0 part /media/Home-Dati
└─sda8   8:8    0 208,4G  0 part /media/Backup
sr0     11:0    1  1024M  0 rom  
sdc      8:32   1   7,5G  0 disk 
├─sdc1   8:33   1   5,2G  0 part 
└─sdc2   8:34   1   2,3G  0 part

4) fdisk -l

 
:~$ sudo fdisk -l
[sudo] password for maurizio: 

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 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
Disk identifier: 0x0001c805

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    78143487    39070720   83  Linux
/dev/sda2        78143488   139405311    30630912   83  Linux
/dev/sda3       139405312   237363199    48978944   83  Linux
/dev/sda4       237363200  3907026943  1834831872    5  Extended
/dev/sda5       237365248  1242853375   502744064   83  Linux
/dev/sda6      1242855424  2900185087   828664832   83  Linux
...

Disk /dev/sdc: 8036 MB, 8036286464 bytes
248 heads, 62 sectors/track, 1020 cylinders, total 15695872 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
Disk identifier: 0x000257cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048    10987519     5492736   83  Linux
/dev/sdc2        10987520    15695871     2354176   83  Linux

5) ls -lah /dev/disk/by-uuid

 
:~$ ls -lah /dev/disk/by-uuid
total 0
drwxr-xr-x 2 root root 500 Apr 13  2014 .
drwxr-xr-x 7 root root 140 Apr 13  2014 ..
lrwxrwxrwx 1 root root  10 Apr 13 15:37 02df3512-3a4f-441e-b982-1f342d36f2d3 -> ../../sdb3
lrwxrwxrwx 1 root root  11 Apr 13 15:37 18013698-ef60-4d3a-910c-55f6c01c9715 -> ../../sda10
lrwxrwxrwx 1 root root  11 Apr 13 15:37 1dc0d5c8-0e62-4150-b916-9c091a3f0bb6 -> ../../sda12
lrwxrwxrwx 1 root root  10 Apr 13 15:37 2804CE5A04CE2AA0 -> ../../sda3
lrwxrwxrwx 1 root root  10 Apr 13 15:37 32c270eb-0313-4665-af9e-e57b87994599 -> ../../sda6
lrwxrwxrwx 1 root root  10 Apr 13 15:37 33e2e165-0a3c-491f-9737-1d03ab416d9b -> ../../sdb1
lrwxrwxrwx 1 root root  10 Apr 13 15:37 5863b781-b44f-488e-8ac0-8d29bd21fa56 -> ../../sdb2
lrwxrwxrwx 1 root root  10 Apr 13 15:37 63b2170d-7225-421f-a85e-13055d9ee5f9 -> ../../sda5
lrwxrwxrwx 1 root root  11 Apr 13 15:37 6762057f-908b-439f-a202-25fc5c98e67e -> ../../sda14
lrwxrwxrwx 1 root root  10 Apr 13 15:37 7C1495031494C196 -> ../../sdb5
lrwxrwxrwx 1 root root  10 Apr 13 15:37 85e0ab2d-d020-4a7c-a6f4-47f557cdaaed -> ../../sda8
lrwxrwxrwx 1 root root  10 Apr 13 15:37 869cb450-cd0c-4173-b0cf-51eadbf4f515 -> ../../sdb8
lrwxrwxrwx 1 root root  10 Apr 13 15:37 94cdb0b3-80c1-4e85-b68a-cff33faa546d -> ../../sdb4
lrwxrwxrwx 1 root root  11 Apr 13 15:37 9c688fc9-c6ad-41d3-891f-d92a13643b79 -> ../../sda11
lrwxrwxrwx 1 root root  11 Apr 13 15:37 a5447856-773c-4c95-8c9b-bc1773a3cf2d -> ../../sda13
lrwxrwxrwx 1 root root  10 Apr 13 15:37 af474d05-52c6-42da-9266-a51bcb4035d3 -> ../../sdb7
lrwxrwxrwx 1 root root  10 Apr 13 15:37 bc46482a-f285-477d-809d-240704b9c852 -> ../../sda9
lrwxrwxrwx 1 root root  10 Apr 13 15:37 bdb62dac-d644-4edc-84f6-ee3d11d829f1 -> ../../sdb6
lrwxrwxrwx 1 root root  10 Apr 13 15:37 c8cf1654-4fcd-4c27-a727-419b31bd94fc -> ../../sda7
lrwxrwxrwx 1 root root  10 Apr 13 15:37 cacc4583-dc7c-4a53-9b2b-6270467f04a0 -> ../../sda2
lrwxrwxrwx 1 root root  11 Apr 13 15:37 cd4bacd9-b9e9-4a78-9b50-9edf69e2b432 -> ../../sda15
lrwxrwxrwx 1 root root  10 Apr 13 15:37 d42589e8-7db1-41c6-83c5-151ffa85c7f6 -> ../../sdb9
lrwxrwxrwx 1 root root  10 Apr 13 15:37 e6448b38-62be-4e1d-a6f4-1951a501fec9 -> ../../sda1

ls -lah /dev/disk/by-uuid

ls -lah /dev/disk/by-uuid

Altri comandi utili:

parted

 
sudo parted /dev/sda print
:~$ sudo parted /dev/sda print
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  40,0GB  40,0GB  primary   ext4         boot
 2      40,0GB  71,4GB  31,4GB  primary   ext4
 3      71,4GB  122GB   50,2GB  primary   ext4
 4      122GB   2000GB  1879GB  extended
 5      122GB   636GB   515GB   logical   ext4
 6      636GB   1485GB  849GB   logical   ext4
 7      1485GB  1777GB  292GB   logical   ext4
 8      1777GB  2000GB  224GB   logical   ext4

file -s

 
:~$ sudo file -s /dev/sda
/dev/sda: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048, 78141440 sectors; partition 2: ID=0x83, starthead 254, startsector 78143488, 61261824 sectors; partition 3: ID=0x83, starthead 254, startsector 139405312, 97957888 sectors; partition 4: ID=0x5, starthead 254, startsector 237363200, 3669663744 sectors, code offset 0x63
ls /sys/dev/block/*
/sys/block
ls /sys/block

Risorse:

 

 

  1. Non c'è ancora nessun commento.
  1. No trackbacks yet.

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger cliccano Mi Piace per questo: