Data is priceless!!!
- Ubuntu Disk Files
In the Ubuntu system, disk device files exist in the form of /dev/sd*, but they cannot be accessed directly. They need to be mounted to a directory in order to be accessed.
/dev/sdb and /dev/sdb1 are the device files for the USB drive.
/dev/sdb represents the USB drive, and /dev/sdb1 represents the first partition of the USB drive.
2. Disk and Directory Capacity Query Commands
df Command
The df command is used to list the overall disk usage of the file system, mainly used to view the usage of each file system.
Example command: df -h
This command will display the usage of the file system, including the total capacity, used capacity, available capacity, and mount point information.
du Command
The du command is used to evaluate the disk usage of the file system, mainly used to view the size of individual files or directories.
Example command: du -sh /path/to/directory
This command will display the total size of the specified directory, where the -s option indicates that only the total size is displayed, and the -h option indicates that the file size is displayed in a human-readable format.
- Disk Mounting, Unmounting, Partitioning, and Formatting
- Mounting and Unmounting Disks
In Ubuntu, the mount and umount commands can be used to mount and unmount disks.
Example command for mounting a disk: sudo mount /dev/sdb1 /mnt/usb
This command mounts the /dev/sdb1 partition to the /mnt/usb directory.
Example command for unmounting a disk: sudo umount /mnt/usb
This command unmounts the disk in the /mnt/usb directory that has been mounted.
2. Disk Partitioning
For disk partitioning operations, the fdisk command can be used.
Example command: sudo fdisk /dev/sdb
This command enters the fdisk interactive interface, where disk partitioning operations such as creating partitions and deleting partitions can be performed.
- Disk Formatting
After the disk partitioning is completed, the mkfs command can be used to format the disk.
Example command: sudo mkfs -t vfat /dev/sdx
This command formats the /dev/sdx device as the VFAT file system, where /dev/sdx is the specific device file name.
This article is synchronized and updated to xLog by Mix Space
The original link is https://api.xn--i2r.cc/posts/Linux-Study/LS4