I would like to know which Disk a database device is being stored. When I use "format" command in SCO Unix command line, it shows that the system has two disks (Disk 0 and Disk 1). They are:
0. c0t0d0 <IBM-DNES-309170-SA30 cyl 11195 alt 2 hd 5 sec 320>
/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@0,0
1. c0t3d0 <SEAGATE-ST34520N-1206 cyl 9004 alt 2 hd 4 sec 246>
/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
When I check my database using sp_helpdb, I find that its data is in "sybdbs" and its transaction log is in "syblogs". And then when I use sp_helpdevice to check, I find these:
device_name physical_name
----------- ------------------
sybdbs /dev/rdsk/c0t0d0s1
syblogs /dev/rdsk/c0t3d0s4
I have used "df /dev/rdsk" command and "df -F ufs" command and confirm that they are in local disks, not in network shared folders.
I would like to know which Disk that /dev/rdsk/c0t0d0s1 is on, and which Disk that /dev/rdsk/c0t3d0s4 is on. How do I do this?
Best Answer
The best thing to do to resolve your question is to run the
lsblk
command. Without any arguments, it gives a great tree view of the system's block devices (see below). Check the man page (lsblk(8)).Then, use
df -h
on your file of interest (in this example, it's the MySQL server).df -ah
gives more information - in this case, the mount point and the filesystem.So, this tells us that mysqld is mounted on /home on the logical volume /dev/mapper/fedora-home. By checking the output of
lsblk
, it can be seen (check below) that it's on the sd5 partition of the sda device.[EDIT - I've added new commands - and I'm giving this question a +1, since I've learnt a truckload trying to answer all of its possiblities! Check out the threads here (1, 2)]
[EDIT2]
Doing yet more exploring, I found these two threads (1, 2) - if you really want to get "down and dirty" with your file system :-). I won't list the output of all the commands found in them - just show some of the interesting ones (hopefully from your perspective). Search for the section also marked [EDIT2] below.
[EDIT3]
Check the end of this post for information I could find on SunOS/Solaris. Search for the section marked [EDIT3].
===============================
Sample output of
df -h
Note that without specifying the file, it gives the result for the entire operating system, but not the entire computer. I also have a Windows OS on the same machine, which does appear with thelsblk
command.So, in your particular case, you want:
and
For logical volumes, use the lvs command - as detailled in this post for more info.
i.e.
sudo lvs -o +devices /dev/rdsk/c0t3d0s4
&c.Sample on my CentOS system:
So, /dev/mapper/fedora-root is on sda5.
On further investigation, I also found this thread and found 3 futher commands.
You could also look at the output of
and
And
lshw -class disk -short
or (verbose)lshw -class disk
Sample of
lsblk
output (really nice tree output!):Sample of
sudo fdisk -l
:and sample of
more /proc/diskstats
:Sample of
sudo lshw -class disk -short
:Or a bit more verbose:
Doing yet more exploring, I found these two threads (1, 2) - if you really want to get "down and dirty" with your file system :-). I won't list the output of all the commands found in them - just show some of the interesting ones (hopefully from your perspective).
[EDIT2].
filefrag
- report on file fragmentation.stat
- display file or file system status.pvs
- report information about physical volumes.dmsetup
- low level logical volume management.For RAID devices, you might want to look at
md/mdmon/mdadm /proc/mdstat
. md - Multiple Device driver aka Linux Software RAID.[EDIT3]
From here and here, it appears that SCO Unix has very little to do with SunOS 5/Solaris. I assume that you are in fact using Solaris of some sort - SunOS hasn't been released under that name for more than 2 decades.
When you say "database device" - do you mean the data files or the server software itself? What RDBMS are you using? Maybe your RDBMS's documentation could help in this regard? And/or newsgroups/lists specialising in that particular server?
I'm afraid I don't have a working version of Solaris to hand (soon - I mean to challenge myself! :-)). I Googled "Solaris which disk is a file on" and found several links which might be useful. Also, check out @mustaccio 's post and this link in it.
I do mean to get into ZFS (are you using that?) and all of this (horribly complex) disk config stuff in "proper" Unix :-), but that's all the help I can be at the moment I'm afraid.