与磁盘相关的命令
1.blkid
1.1 blkid 查询所有的设备的文件系统类型

1.2
[root@xiaowo /]# blkid --help blkid: invalid option -- '-' blkid from util-linux 2.23.2 (libblkid 2.23.0, 25-Apr-2013) Usage: blkid -L <label> | -U <uuid> blkid [-c <file>] [-ghlLv] [-o <format>] [-s <tag>] [-t <token>] [<dev> ...] blkid -p [-s <tag>] [-O <offset>] [-S <size>] [-o <format>] <dev> ... blkid -i [-s <tag>] [-o <format>] <dev> ... Options: -c <file> read from <file> instead of reading from the default cache file (-c /dev/null means no cache) -d don't encode non-printing characters -h print this usage message and exit -g garbage collect the blkid cache -o <format> output format; can be one of: value, device, export or full; (default: full) -k list all known filesystems/RAIDs and exit -s <tag> show specified tag(s) (default show all tags) -t <token> find device with a specific token (NAME=value pair) -l look up only first device with token specified by -t -L <label> convert LABEL to device name -U <uuid> convert UUID to device name -V print version and exit <dev> specify device(s) to probe (default: all devices) Low-level probing options: -p low-level superblocks probing (bypass cache) -i gather information about I/O limits -S <size> overwrite device size -O <offset> probe at the given offset -u <list> filter by "usage" (e.g. -u filesystem,raid) -n <list> filter by filesystem type (e.g. -n vfat,ext3)
2.ls -l /dev/disk/by-partuuid #partuuid暂时理解是磁盘分区的的uuid
ls -l /dev/disk/by-uuid/

3.df -h
[root@xiaowo /]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 908M 0 908M 0% /dev tmpfs 919M 24K 919M 1% /dev/shm tmpfs 919M 560K 919M 1% /run tmpfs 919M 0 919M 0% /sys/fs/cgroup /dev/vda1 40G 2.7G 35G 8% / tmpfs 184M 0 184M 0% /run/user/0 tmpfs 184M 0 184M 0% /run/user/1000
4.cat /etc/fstab
[root@xiaowo /]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Thu Mar 7 06:38:37 2019 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=4b499d76-769a-40a0-93dc-4a31a59add28 / ext4 defaults 1 1
4.lsblk
[root@xiaowo /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 40G 0 disk
└─vda1 253:1 0 40G 0 part /
5.mount
[root@xiaowo /]# mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,size=929312k,nr_inodes=232328,mode=755) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu) cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event) cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) configfs on /sys/kernel/config type configfs (rw,relatime) /dev/vda1 on / type ext4 (rw,relatime,data=ordered) systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=10983) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) mqueue on /dev/mqueue type mqueue (rw,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=188184k,mode=700) tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=188184k,mode=700,uid=1000,gid=1000)
5.1 mount可以将分区挂接到Linux的一个文件夹下,从而将分区和该目录联系起来,因此我们只要访问这个文件夹,就相当于访问该分区了。
6.cat /etc/filesystems
[root@xiaowo /]# cat /etc/filesystems xfs ext4 ext3 ext2 nodev proc nodev devpts iso9660 vfat hfs hfsplus *
7.fdisk
[root@xiaowo /]# fdisk Usage: fdisk [options] <disk> change partition table fdisk [options] -l <disk> list partition table(s) fdisk -s <partition> give partition size(s) in blocks Options: -b <size> sector size (512, 1024, 2048 or 4096) -c[=<mode>] compatible mode: 'dos' or 'nondos' (default) -h print this help text -u[=<unit>] display units: 'cylinders' or 'sectors' (default) -v print program version -C <number> specify the number of cylinders -H <number> specify the number of heads -S <number> specify the number of sectors per track
7.1 fdisk -l
[root@xiaowo /]# fdisk -l Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0009ac89 Device Boot Start End Blocks Id System /dev/vda1 * 2048 83886046 41941999+ 83 Linux
fdisk /dev/vda
[root@xiaowo /]# fdisk /dev/vda Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): m #输入m 或者h获取帮助 Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): p #输入p查看已划分好的分区 Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0009ac89 Device Boot Start End Blocks Id System /dev/vda1 * 2048 83886046 41941999+ 83 Linux
新磁盘插入创建主分区 https://blog.csdn.net/weixin_30010599/article/details/116773667
n创建一个分区 显示主分区和拓展分区,p是主分区 ,e是拓展分区
输入p 输入1 ,敲回车()整块硬盘最为第一个主分区,之后用p来确认下。
https://www.cnblogs.com/w-wfy/p/8870773.html linux添加新磁盘和创建分区
本文来自博客园,作者:蜗小蜗,转载请注明原文链接:https://www.cnblogs.com/xiaowobklogs/p/16083451.html
浙公网安备 33010602011771号