Linux Disk Command

芒果牛奶 2021-02-23 16:08:09
linux 操作系统 SegmentFault command disk


df -h 查看磁盘空间

du -h ./ --max-depth=1 查看当前目录下,每个子目录的磁盘空间

fdisk -l 查看硬盘(已格式化和未格式化都能看到)

fdisk /dev/sda,sdb,sdc (格式化或者重写磁盘分区)


Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x22badbc1.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): d
No partition is defined yet!

Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1
First sector (63-4294967295, default 63):
Using default value 63
Last sector, +sectors or +size{K,M,G} (63-4294967294, default 4294967294):
Using default value 4294967294

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


mkfs.ext4 /dev/xvdb1
mkfs.xfs /dev/xvdb1
mkdir /storage


parted /dev/xvdb1
(parted) print list


mount /dev/xvdb1 /storage
df -h


ll /dev/disk/by-uuid/
vi /etc/fstab

UUID=0e85f57a-1f21-411d-afab-c5c976bc5659 /nfs_file ext4 defaults 0 0


dd if=/dev/zero of=/swapfile bs=1M count=1024
chown root:root /swapfile
chmod 0600 /swapfile
mkswap -f /swapfile

echo '/swapfile none swap defaults,nofail 0 0' >> /etc/fstab
swapon -a
free -mt


df -h
du -h ./ --max-depth=1


lsof | grep ‘delete’|head -50

LogStash: 1912 1965 root 136r REG 259,0 3490517867 402677903 /data/logs/2019/12/15/app-1b-node2/apache-access.log (deleted)


systemctl status logstash


  1. Deep understanding of Web protocol (3): http 2
  2. Tencent IEG open source AI SDK: automatic testing of chicken eating and MoBa games
  3. Mysql Command
  4. Docker dockerfile create image
  5. Redis Cluster
  6. 死磕Spring之IoC篇 - 文章导读
  7. Deep understanding of Web protocol (3): http 2
  8. JavaScript BOM operation
  9. JavaScript BOM operation
  10. 死磕Spring之IoC篇 - 文章导读
  11. k8s node 操作与维护
  12. k8s 证书更新
  13. 【Java面试题第三期】JVM中哪些地方会出现内存溢出?出现的原因是什么?
  14. HashMap连环问你能答出几道?
  15. k8s-cronjob
  16. k8s-cert
  17. 头条面试官:说说Kafka的消费者提交方式,怎么实现的
  18. 什么是HTTPS以及如何实施HTTPS?
  19. Spring: an introduction to IOC
  20. Spring: an introduction to IOC
  21. Operation and maintenance of k8s node
  22. K8s certificate update
  23. vue使用sdk进行七牛上传
  24. k8s-dns
  25. JavaScript 邮箱验证 - 正则验证
  26. k8s-dashboard
  27. HashMap连环问你能答出几道?
  28. Where does memory overflow occur in the JVM? What are the reasons for this?
  29. How many questions can you answer?
  30. k8s-cronjob
  31. spring注解--Transactional
  32. k8s-cert
  33. Will the Spring Festival holiday be extended to February 27 in 2021? Here comes the response
  34. Headline Interviewer: talk about Kafka's consumer submission method, how to achieve it
  35. 【k8s集群】搭建步骤
  36. k8s-kubeadm
  37. k8s-etcd
  38. What is HTTPS and how to implement it?
  39. Java中使用HashMap改进查找性能
  40. maven发布jar包运行时找不到类问题
  41. J2EE
  42. Vue uses SDK to upload seven cows
  43. k8s-dns
  44. JavaScript mailbox verification - regular verification
  45. k8s-dashboard
  46. How many questions can you answer?
  47. Spring annotation -- transactional
  48. [k8s cluster] construction steps
  49. k8s-kubeadm
  50. k8s-etcd
  51. Using HashMap to improve search performance in Java
  52. There is no class problem when Maven publishes jar package
  53. JavaScriptBOM操作
  54. J2EE
  55. k8s-prometheus-memory
  56. k8s-prometheus disk
  57. k8s-prometheus
  58. JavaScript BOM operation
  59. k8s-prometheus-memory
  60. k8s-prometheus disk