如何查看linux服务器上有几块磁盘

如何查看linux服务器上有几块磁盘,第1张

有多种方式查看linux服务器上有几块磁盘

方法1:

[root@localhost xly]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sr0 11:0 1 1024M 0 rom

sda 8:0 0 40G 0 disk

├─sda1 8:1 0 300M 0 part /boot

├─sda2 8:2 0 178G 0 part /

└─sda3 8:3 0 2G 0 part [SWAP]

sdb 8:16 0 20G 0 disk /opt

可知系统有sda和sdb两块磁盘

方法2:

[root@localhost xly]# fdisk -l

Disk /dev/sda: 429 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00041bdd

Device Boot Start End Blocks Id System

/dev/sda1 1 39 307200 83 Linux

Partition 1 does not end on cylinder boundary

/dev/sda2 39 2358 18631680 83 Linux

/dev/sda3 2358 2611 2031616 82 Linux swap / Solaris

Disk /dev/sdb: 215 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

如果你是copy或者克隆的虚拟机,打开时有提示让你选择是moved的还是copyed的,选择copy就会重设硬盘id,mac值可以system-config-network中把网卡mac重新生成一下。

Linux下获取当前线程ID号函数:

pthread_t pthread_self();

返回:当前线程的ID号

pthread_t 数据类型的定义如下:

typedef unsigned long int pthread_t;

sizeof(pthread_t) = 4,4个字节的整数。

Windows下获取当前线程ID号的函数:

DWORD GetCurrentThreadId();

返回值:当前线程的ID号

DWORD数据类型定义:

typedef unsigned long DWORD;

在Windows下pthread-win库的pthread_t定义如下:

typedef struct {

void p; /Pointer to actual object /

unsigned int x; /Extra information - reuse count etc /

} ptw32_handle_t;

typedef ptw32_handle_t pthread_t;

与Linux的thread_t不一样,它是一个结构,不是一个整数值

在Windows和Linux下可用的获取线程ID号的内联函数如下:

#ifdef WIN32

#include <windowsh>

#else

#include <pthreadh>

#endif

inline unsigned int PthreadSelf()

{

#ifdef WIN32

return::GetCurrentThreadId();

#else

returnthread_self();

#endif

}

以上就是关于如何查看linux服务器上有几块磁盘全部的内容,包括:如何查看linux服务器上有几块磁盘、怎样修改linux系统的虚拟机的硬盘ID和MAC值、如何在Windows和Linux下获取当前线程的ID号等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/9544338.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存