linux下文件系统操作整合


简介

linux下对于文件系统的操作的一些集合

开机挂载文件

查看Linux硬盘信息:

sudo fdisk -l 

格式化硬盘

sudo mkfs.ext4 /dev/sdb

创建/data目录

sudo mkdir /data

挂载分区:

sudo mount /dev/sdb /data

查看磁盘分区的UUID

sudo sudo blkid

挂配置开机自动挂载:

echo "UUID= /data ext4 defaults 0 1" >> /etc/fstab

测试配置文件是否正确:

sudo mount -a

扩充硬盘

安装parted

apt-get install -y parted

parted

➜  parted /dev/sdb
GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 236GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End    Size   File system  Flags
 1      0.00B  236GB  236GB  ext4

(parted) resizepart 1
Warning: Partition /dev/sdb is being used. Are you sure you want to continue?
Yes/No? yes
End?  [236GB]?
(parted) q
Information: You may need to update /etc/fstab.

resize2fs

➜  resize2fs /dev/sdb 
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/sdb is mounted on /data; on-line resizing required
old_desc_blocks = 27, new_desc_blocks = 28
The filesystem on /dev/sdb is now 57671680 (4k) blocks long.

文章作者: xyzz
文章链接: http://www.xyzzpwn.top
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 xyzz !
 上一篇
win10_2004全软件模版 win10_2004全软件模版
简介关于win10下使用的软件等全功能模版机子使用的软件的大全 开发IDE vscode visual studio sublime text JetBrains GoLand JetBrains CLion JetBrains Pycha
下一篇 
syscall table syscall table
简介linux syscall table x64 %rax Name Entry point Implementation 0 read sys_read fs/read_write.c 1 write sys_w
2020-12-10
  目录