Linux Disk Command

Mango milk 2021-02-23 16:09:45
linux disk command


disk - Partition - format - mount

df -h View disk space

du -h ./ --max-depth=1 View the current directory , Disk space per subdirectory

fdisk -l Check out the hard disk ( You can see both formatted and unformatted )

fdisk /dev/sda,sdb,sdc ( Format or rewrite the partition )

Partition


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)
p
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.

Create a file system format

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

Look at the file system format

parted /dev/xvdb1
(parted) print list

mount

mount /dev/xvdb1 /storage
df -h

Set boot up

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

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

======swap=====


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

Disk space is not free

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

View current occupancy , Found inconsistent with disk , File deleted , Still occupied , Disk space is not free

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)

Found to be LogStash Process occupation , Consider whether to restart the business logstash service

systemctl status logstash

版权声明
本文为[Mango milk ]所创,转载请带上原文链接,感谢
https://javamana.com/2021/02/20210223160805508h.html

  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