20231218在Ubuntu18.04下以EXT4格式化HDD

20231218在Ubuntu18.04下以EXT4格式化HDD
2023/12/18 17:24


缘起:
编译一个Android10+大概要200GB,编译10+个Android10+的SDK,3TB的HDD机械硬盘就估计会被填满了!
如果使用rm -rf *这个命令将SDK一个一个逐个地删除,估计2小时+(可能大半天就没有了。)
想过WINDOWS下的解决方式,直接格式化!

20231218在Ubuntu18.04下以EXT4格式化HDD_第1张图片


百度搜索:ubuntu 格式化分区
https://blog.51cto.com/u_4042309/3603342
Ubuntu - 硬盘分区、格式化、自动挂载配置

在终端窗口中输入如下命令:
sudo mount -t ext4 /dev/sdb /devdata
说明:
指定硬盘分区文件系统类型为ext4 ,同时将 /dev/sdb 分区挂载到目录 /devdata。

20231218在Ubuntu18.04下以EXT4格式化HDD_第2张图片20231218在Ubuntu18.04下以EXT4格式化HDD_第3张图片

20231218在Ubuntu18.04下以EXT4格式化HDD_第4张图片


ootroot@rootroot-X99-Turbo:/etc$ sudo umount /home/rootroot/3TB 
umount: /home/rootroot/3TB: target is busy.
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ sudo mkfs -t ext4 /
/dev/loop0      /dev/loop11     /dev/loop14     /dev/loop17     /dev/loop2      /dev/loop22     /dev/loop3      /dev/loop6      /dev/loop9      /dev/nvme0n1p2  /dev/nvme0n1p5  /dev/sda        
/dev/loop1      /dev/loop12     /dev/loop15     /dev/loop18     /dev/loop20     /dev/loop23     /dev/loop4      /dev/loop7      /dev/nvme0n1    /dev/nvme0n1p3  /dev/nvme0n1p6  /path/to/file   
/dev/loop10     /dev/loop13     /dev/loop16     /dev/loop19     /dev/loop21     /dev/loop24     /dev/loop5      /dev/loop8      /dev/nvme0n1p1  /dev/nvme0n1p4  /dev/nvme0n1p7  
rootroot@rootroot-X99-Turbo:/etc$ sudo mkfs -t ext4 /dev/sda
mke2fs 1.44.1 (24-Mar-2018)
/dev/sda contains a ext4 file system
    last mounted on /home/rootroot/3TB on Sat Dec 16 09:00:38 2023
Proceed anyway? (y,N) y
/dev/sda is mounted; will not make a filesystem here!
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ sudo umount /dev/sda
umount: /home/rootroot/3TB: target is busy.


百度:/dev/sda is mounted; will not make a filesystem here!
百度:umount: /home/rootroot/3TB: target is busy.
https://blog.csdn.net/qq_35444051/article/details/130979470
卸载磁盘时报错:‘Umount Target is Busy‘

sudo lsof /Path/to/target


rootroot@rootroot-X99-Turbo:/etc$ sudo lsof /dev/sda
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
smbd    2892 root   34r   DIR    8,0     4096    2 /home/rootroot/3TB
smbd    2892 root   35r   DIR    8,0     4096    2 /home/rootroot/3TB
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ sudo kill -9 2892
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ sudo lsof /dev/sda

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ sudo umount /dev/sda
rootroot@rootroot-X99-Turbo:/etc$ 
rootroot@rootroot-X99-Turbo:/etc$ sudo mkfs -t ext4 /dev/sda

mke2fs 1.44.1 (24-Mar-2018)
/dev/sda contains a ext4 file system
    last mounted on /home/rootroot/3TB on Sat Dec 16 09:00:38 2023
Proceed anyway? (y,N) y
Creating filesystem with 732566646 4k blocks and 183148544 inodes
Filesystem UUID: 87934346-2be0-4970-87f5-a1c3727a970f
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done       

rootroot@rootroot-X99-Turbo:/etc$ 


结果:重启之后,结果ubuntu黑屏了,原因不明。我直接格式化【系统】了,【然后】重装【整台电脑的WIN10/Ubuntu20.04】了!
【步骤应该没有问题呀!^_】

20231218在Ubuntu18.04下以EXT4格式化HDD_第5张图片

dev/nwmeon1n7:recovering iournal

dew/numeon1n7:clean,300464/2992416 files, 3898699/11962880 b1ocks

3.596527] EDAC sbridge: CPU SrcID #O, Ha #0, Channel #1 has DIMMs, but ECCis disabled

3.5965791EDACsbridge: Couldn't find mci handler

3.5966051EDACsbridge: Couldn't find mci handler3.5966321sbridge: Failed to register device with error -19EDAC

You are in emergency mode. After logging in, type "journalct1 -xh"system logs."systemctI reboot' to reboot , "systemctl default"to boot into default. mode .to view

Press Enter for maintenanceor 'exit

(or press Control-D to cont inue) :

root@rootroot-x99-Turho:'#


稳妥的步骤:
rootroot@rootroot-X99-Turbo:/etc$ sudo cp fstab fstab.bak2
rootroot@rootroot-X99-Turbo:/etc$ cp fstab.bak1 fstab
rootroot@rootroot-X99-Turbo:/etc$ sudo reboot

rootroot@rootroot-X99-Turbo:/etc$ sudo lsof /dev/sda
rootroot@rootroot-X99-Turbo:/etc$ sudo mkfs -t ext4 /dev/sda
【然后重新挂载/dev/sda即可!】

参考资料:
https://blog.csdn.net/nielinyuan1466/article/details/131953088
ubuntu磁盘分区、格式化、挂载


https://blog.51cto.com/xyzlinux/1530157
创建分区、格式化分区、挂载分区 原创

你可能感兴趣的:(杂质,杂质)