Linux'ta Diskler Hakkında Bilgi Almak
Linux'ta sistem bilgilerini edinmek için kullanabileceğiniz pek çok araç mevcut. Bu yazıda, "diskler (HDD, SSD)" hakkında bilgi almak için kullanılabilecek bazı komutları inceleyeceğiz.
fdisk -l
fdisk -l
komutu ile, sisteminizdeki diskleri ve bu disklerin partition bilgilerini listeleyebilirsiniz. Bu komut, "root" yetkileri gerektirir:
[root@gnuadmin ~]# fdisk -l
Disk /dev/vda: 26.8 GB, 26843545600 bytes, 52428800 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 label type: dos
Disk identifier: 0x000940fd
Aygıt Açılış Başlangıç Bitiş BlokSayısı Kml Sistem
/dev/vda1 * 2048 52428766 26213359+ 83 Linux
Disk /dev/vdb: 0 MB, 477184 bytes, 932 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
parted
parted
programının "print" opsiyonu ile, diskleriniz ve disklerinizin partition'ları hakkında bilgi alabilirsiniz. Bu komut, "root" yetkileri gerektirir:
ali@zion:~$ sudo parted
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print all
Model: ATA TOSHIBA-TR200 (scsi)
Disk /dev/sda: 480GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
2 538MB 480GB 480GB lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vgubuntu-swap_1: 1028MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 1028MB 1028MB linux-swap(v1)
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vgubuntu-root: 479GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 479GB 479GB ext4
lsblk
lsblk
komutu ile, sisteminizdeki blok aygıtlarını listeleyebilirsiniz:
ali@gnuadmin:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
|-sda1 8:1 0 487M 0 part /boot
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 29.5G 0 part
|-debian--vg-root 254:0 0 28.6G 0 lvm /
`-debian--vg-swap_1 254:1 0 980M 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
|-sdb1 8:17 0 2G 0 part
|-sdb2 8:18 0 2G 0 part
`-sdb3 8:19 0 6G 0 part
sr0 11:0 1 1024M 0 rom
lsblk
komutunun, çıktılarınızı özelleştirmenizi sağlayacak birçok opsiyonu bulunmaktadır. Aşağıdaki örnekte; partition'lar üzerindeki dosya sistemlerini (-f), ağaç yapısı olmadan (-l) ve aygıtların tam yolunu gösterecek şekilde (-p) bir listeleme yapılmıştır:
ali@gnuadmin:~$ lsblk -flp
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
/dev/sda
/dev/sda1 ext2 1.0 986a4295-b3a9-4afb-8f01-40e9b1c42c2c 384.5M 13% /boot
/dev/sda2
/dev/sda5 LVM2_member LVM2 001 hdI0w3-jztQ-fWrB-y8Do-inaY-UO0e-NpfRZY
/dev/sdb
/dev/sdb1
/dev/sdb2
/dev/sdb3
/dev/sr0
/dev/mapper/debian--vg-root ext4 1.0 9d80b4d6-b4a8-4801-ad93-fd9458f1d84e 22.4G 15% /
/dev/mapper/debian--vg-swap_1 swap 1 ae4371ea-31db-4bb7-8927-8b4053d44036 [SWAP]
Linux'ta Disk Hakkında Detaylı Bilgi Alma
Eğer yukarıdaki komutların sağladığından daha fazla teknik bilgiye ihtiyacınız varsa, smartctl
komutu size yardımcı olabilir. smartctl
programı, Debian tabanlı sistemlerde, smartmontools
paketi ile gelmektedir. smartctl
, "root" yetkileri gerektirmektedir:
ali@zion:~$ sudo smartctl -a /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.13.0-40-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: TOSHIBA-TR200
Serial Number: 49JB8006KBSN
LU WWN Device Id: 5 8ce38e c01206376
Firmware Version: SBFA15.2
User Capacity: 480,103,981,056 bytes [480 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-4 (minor revision not indicated)
SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Thu May 12 19:18:06 2022 +03
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Total time to complete Offline
data collection: ( 30) seconds.
Offline data collection
capabilities: (0x00) Offline data collection not supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 10573
12 Power_Cycle_Count 0x0012 100 100 000 Old_age Always - 1912
167 Unknown_Attribute 0x0022 100 100 000 Old_age Always - 0
168 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0
169 Unknown_Attribute 0x0003 100 100 010 Pre-fail Always - 0
173 Unknown_Attribute 0x0012 187 187 000 Old_age Always - 0
192 Power-Off_Retract_Count 0x0012 100 100 000 Old_age Always - 122
194 Temperature_Celsius 0x0023 071 053 020 Pre-fail Always - 29 (Min/Max 13/47)
241 Total_LBAs_Written 0x0032 100 100 000 Old_age Always - 353920
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
Selective Self-tests/Logging not supported
Linux'ta Disklerin UUID Bilgilerini Alma
blkid
komutunu kullanarak, blok aygıtlarınızın özelliklerini listeleyebilirsiniz:
ali@gnuadmin:~$ sudo blkid
/dev/sda1: UUID="986a4295-b3a9-4afb-8f01-40e9b1c42c2c" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="a422b442-01"
/dev/sda5: UUID="hdI0w3-jztQ-fWrB-y8Do-inaY-UO0e-NpfRZY" TYPE="LVM2_member" PARTUUID="a422b442-05"
/dev/mapper/debian--vg-root: UUID="9d80b4d6-b4a8-4801-ad93-fd9458f1d84e" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/debian--vg-swap_1: UUID="ae4371ea-31db-4bb7-8927-8b4053d44036" TYPE="swap"
/dev/sdb1: PARTUUID="830a162b-01"
/dev/sdb2: PARTUUID="830a162b-02"
/dev/sdb3: PARTUUID="830a162b-03"