Tuesday, February 9, 2016

How to display all partitions in Unix systems

How to check partitions on your Unix based system.

Use df command (abbreviation of disk free is a standard Unix command used to display the amount of available disk space for file systems):

mpjanic@valkyr:/home/towerraid$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/valkyr--vg-root   15T   12T  1.6T  89% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         126G  4.0K  126G   1% /dev
tmpfs                         26G  1.5M   26G   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         126G     0  126G   0% /run/shm
none                         100M     0  100M   0% /run/user
/dev/sdb2                    237M  145M   80M  65% /boot
//171.65.68.192/diskstation   33T   12T   21T  37% /home/diskstation
//171.65.68.192/usbshare1-2  7.3T  681G  6.7T  10% /home/diskstation2
/dev/sda1                     33T   29T  2.1T  94% /home/towerraid


Use lsblk command (lists information about all available or the specified block devices):


mpjanic@valkyr:/home/towerraid$ lsblk
NAME                           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                              8:0    0  32.8T  0 disk
└─sda1                           8:1    0  32.8T  0 part  /home/towerraid
sdb                              8:16   0  14.6T  0 disk
├─sdb1                           8:17   0     1M  0 part
├─sdb2                           8:18   0   244M  0 part  /boot
└─sdb3                           8:19   0  14.6T  0 part
  └─sda3_crypt (dm-0)          252:0    0  14.6T  0 crypt
    ├─valkyr--vg-root (dm-1)   252:1    0  14.3T  0 lvm   /
    └─valkyr--vg-swap_1 (dm-2) 252:2    0   256G  0 lvm
sr0                             11:0    1  1024M  0 rom


Use lsusb command (displaying information about USB buses in the system):


mpjanic@valkyr:/home/towerraid$ lsusb
Bus 002 Device 003: ID 0557:2221 ATEN International Co., Ltd Winbond Hermon
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 152d:0551 JMicron Technology Corp. / JMicron USA Technology Corp.
Bus 001 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub



Use fdisk (a command-line utility that provides disk partitioning):


mpjanic@valkyr:/home/towerraid$ sudo fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 36006.6 GB, 36006589890560 bytes
256 heads, 63 sectors/track, 4360452 cylinders, total 70325370880 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  4294967295  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 15997.9 GB, 15997894131712 bytes
255 heads, 63 sectors/track, 1944966 cylinders, total 31245886976 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/mapper/sda3_crypt: 15997.6 GB, 15997633298432 bytes
255 heads, 63 sectors/track, 1944934 cylinders, total 31245377536 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/sda3_crypt doesn't contain a valid partition table

Disk /dev/mapper/valkyr--vg-root: 15722.8 GB, 15722797334528 bytes
255 heads, 63 sectors/track, 1911521 cylinders, total 30708588544 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/valkyr--vg-root doesn't contain a valid partition table

Disk /dev/mapper/valkyr--vg-swap_1: 274.8 GB, 274831769600 bytes
255 heads, 63 sectors/track, 33413 cylinders, total 536780800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/valkyr--vg-swap_1 doesn't contain a valid partition table


Use mount command


mpjanic@valkyr:/home/towerraid$ mount | grep "^/dev"
/dev/mapper/valkyr--vg-root on / type ext4 (rw,errors=remount-ro)
/dev/sdb2 on /boot type ext2 (rw)
/dev/sda1 on /home/towerraid type ext4 (rw)

No comments:

Post a Comment