磁盘管理

创建设备文件
    
磁盘设备的设备文件名
    IDE,ATA :hd  
    SATA : sd
    SCSI : sd
    USB : sd
       a,b,c 来区别同一种类型下的不通设备

    第一个IDE口:主从
    /dev/sda /dev/sdb
    第二个IDE口:主从
    /dev/sdc /dev/sdd

    hda
       hda1:第一个主分区
       hda2:
       hda3:
       hda3:
       hda4:
       hda5:第一个逻辑分区
  
当前系统识别了多少块硬盘
    fdisk -l

管理磁盘分区(文件系统是内核功能)
    mkfs -t ext3

    fdisk -l /dev/sda
    fdisk /dev/sda
        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)
           
查看分区表 
    cat /proc/partitions
    major minor  #blocks  name

      11        0    1048575 sr0
       8        0   10485760 sda
       8        1    1048576 sda1
       8        2    9436160 sda2
     253        0    8384512 dm-0
     253        1    1048576 dm-1
 
内核重新读分区表
     partprobe 
 
 free -m 
swap分区
  fdisk命令中,调整分区类型为82
  mkswap /dev/sda8
        -L label
 
  mount -t swap /dev/sda8 swap
  swapon -a 启动所有/etc/fstab  
  swapoff
  
创建一个镜像文件
     dd if=/path/to of=/etc/path/to
     bs=1024 count=2 seek=1023 跳过的空间大小
  
  
    dd if=/etc/inittab of=/home/young/inittab bs=1 count=10
    10+0 records in
    10+0 records out
    10 bytes (10 B) copied, 0.000465785 s, 21.5 kB/s
    
    dd if=/dev/zero of=/var/swapfile bs=100M count=2
    
    
    du
    
    mount挂在ISO文件
    mount-o loop //   /media 本地回环设备,软件模拟的硬件设备
    
    /etc/fstab OS初始是自动挂在定义在该文件里的设备
                            挂载点                  文件系统  挂在选项    转储频率(多少天做一次备份,0不备份)  自检次序
    /dev/mapper/cl-root     /                       xfs     defaults        0                                   0


    mount -a 挂载/etc/fstab 文件中定义的所有文件系统
    
    fuser -km /mnt/test 杀死使用该文件的进程
    
    umount

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值