美文网首页
Linux查看磁盘信息和挂载磁盘的命令

Linux查看磁盘信息和挂载磁盘的命令

作者: 升级打怪的V208 | 来源:发表于2018-04-28 16:37 被阅读0次

    1.sudo fdisk -l 查看磁盘信息,包括磁盘的数量和大小等

    zhou@zhou-QiTianM4650-N000:~$ sudo fdisk -l 
    [sudo] zhou 的密码: 
    Disk /dev/loop0: 138.1 MiB, 144834560 bytes, 282880 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 /dev/loop1: 86.5 MiB, 90726400 bytes, 177200 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 /dev/loop2: 86.6 MiB, 90759168 bytes, 177264 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 /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: dos
    Disk identifier: 0xee536855
    
    设备       启动      Start     末尾     扇区   Size Id 类型
    /dev/sda1  *          2048    1026047    1024000   500M  7 HPFS/NTFS/exFAT
    /dev/sda2          1026048  519397375  518371328 247.2G  7 HPFS/NTFS/exFAT
    /dev/sda3       1742327216 1953521071  211193856 100.7G  7 HPFS/NTFS/exFAT
    /dev/sda4        519399422 1742325759 1222926338 583.1G  f W95 扩展 (LBA)
    /dev/sda5        519399424 1008324015  488924592 233.1G  7 HPFS/NTFS/exFAT
    /dev/sda6       1322897408 1326802943    3905536   1.9G 83 Linux
    /dev/sda7       1326804992 1342427135   15622144   7.5G 82 Linux 交换 / Solaris
    /dev/sda8       1342429184 1404927999   62498816  29.8G 83 Linux
    /dev/sda9       1404930048 1443989503   39059456  18.6G 83 Linux
    /dev/sda10      1443991552 1742325759  298334208 142.3G 83 Linux
    /dev/sda11      1008326656 1322896815  314570160   150G 83 Linux
    
    Partition 4 does not start on physical sector boundary.
    Partition table entries are not in disk order.
    

    2.sudo partprobe 重载分区表

    zhou@zhou-QiTianM4650-N000:~$ sudo partprobe
    zhou@zhou-QiTianM4650-N000:~$ 
    zhou@zhou-QiTianM4650-N000:~$ 
    

    3.sudo mkfs.ext4 /dev/sda11 格式化新分区为ext4格式,格式化sda11

    zhou@zhou-QiTianM4650-N000:~$ sudo mkfs.ext4  /dev/sda11
    mke2fs 1.42.13 (17-May-2015)
    Creating filesystem with 39321270 4k blocks and 9830400 inodes
    Filesystem UUID: 064358e0-d4f5-4a41-9669-6aba79e81cde
    Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872
    
    Allocating group tables: 完成                            
    正在写入inode表: 完成                            
    Creating journal (32768 blocks): 完成
    Writing superblocks and filesystem accounting information: 完成     
    

    4.mkdir 创建空白文件夹,后面跟名称

    zhou@zhou-QiTianM4650-N000:~$ mkdir space 
    

    5.mount /dev/sda11 space 挂载命令,后面是文件位置

    hou@zhou-QiTianM4650-N000:~$ mount /dev/sda11 .space 
    mount: only root can do that
    zhou@zhou-QiTianM4650-N000:~$ sudo mount /dev/sda11 .space 
    mount: mount point .space does not exist
    zhou@zhou-QiTianM4650-N000:~$ sudo mount /dev/sda11 space 
    

    6.sudo gedit /etc/fstab 操作挂载信息,避免开机重新挂载

    zhou@zhou-QiTianM4650-N000:~$ gedit /etc/fstab 
    zhou@zhou-QiTianM4650-N000:~$ sudo gedit /etc/fstab 
    
    (gedit:3178): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
    
    ** (gedit:3178): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-spell-enabled
    
    ** (gedit:3178): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-encoding
    
    ** (gedit:3178): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-position
    

    7.sudo chown zhou:zhou space chown是改变指定文件的拥有者改为指定的用户或组

    drwxr-xr-x 32 zhou zhou  4096 4月  28 15:25 ./
    drwxr-xr-x  4 root root  4096 3月  31 16:49 ../
    -rw-------  1 zhou zhou  7630 4月  28 13:50 .bash_history
    -rw-r--r--  1 zhou zhou   220 3月  31 16:49 .bash_logout
    -rw-r--r--  1 zhou zhou  3814 4月  22 17:53 .bashrc
    drwxrwxr-x  2 zhou zhou  4096 4月  26 08:37 bro/
    drwx------ 18 zhou zhou  4096 4月  24 11:07 .cache/
    drwx------  3 zhou zhou  4096 3月  31 17:00 .compiz/
    drwx------ 23 zhou zhou  4096 4月  22 19:31 .config/
    drwx------  3 zhou zhou  4096 3月  31 16:59 .dbus/
    drwxrwxr-x 15 zhou zhou 12288 4月  23 15:08 depot_tools/
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Desktop/
    -rw-r--r--  1 zhou zhou    25 3月  31 16:59 .dmrc
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Documents/
    drwxr-xr-x  2 zhou zhou  4096 4月  22 16:00 Downloads/
    -rw-r--r--  1 zhou zhou  8980 3月  31 16:49 examples.desktop
    drwx------  2 zhou zhou  4096 4月  22 15:42 .gconf/
    -rw-rw-r--  1 zhou zhou    74 4月  22 12:53 .gitconfig
    drwx------  3 zhou zhou  4096 4月  28 15:14 .gnupg/
    -rw-------  1 zhou zhou  7560 4月  28 15:14 .ICEauthority
    -rw-rw-r--  1 zhou zhou 23311 4月  21 20:57 index.html
    drwx------  3 zhou zhou  4096 3月  31 16:59 .local/
    drwx------  5 zhou zhou  4096 4月   5 04:33 .mozilla/
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Music/
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Pictures/
    drwx------  2 zhou zhou  4096 3月  31 16:59 .presage/
    -rw-r--r--  1 zhou zhou   655 3月  31 16:49 .profile
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Public/
    drwxr-xr-x  3 zhou zhou  4096 4月  22 10:28 snap/
    drwxr-xr-x  3 root root  4096 4月  28 15:17 space/
    drwx------  2 zhou zhou  4096 4月   4 21:23 .ssh/
    -rw-r--r--  1 zhou zhou     0 4月   5 04:28 .sudo_as_admin_successful
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Templates/
    drwxr-xr-x  2 zhou zhou  4096 4月  22 10:28 Videos/
    -rw-------  1 zhou zhou   132 4月  28 15:14 .Xauthority
    -rw-------  1 zhou zhou    84 4月  28 15:14 .xsession-errors
    -rw-------  1 zhou zhou    84 4月  28  2018 .xsession-errors.old
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 公共的/
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 模板/
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 视频/
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 图片/
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 文档/
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 下载/
    drwxr-xr-x  2 zhou zhou  4096 3月  31 16:59 音乐/
    drwxr-xr-x  2 zhou zhou  4096 4月  24 23:26 桌面/
    zhou@zhou-QiTianM4650-N000:~$ sudo chown zhou:zhou space
    

    相关文章

      网友评论

          本文标题:Linux查看磁盘信息和挂载磁盘的命令

          本文链接:https://www.haomeiwen.com/subject/afbglftx.html