• [草稿]挂载新硬盘


    查看新硬盘&创建分区

    xxx@xxx:/dev$ sudo fdisk -l
    [sudo] password for xxx: 
    
    Disk /dev/sda: 85.9 GB, 85899345920 bytes
    255 heads, 63 sectors/track, 10443 cylinders, total 167772160 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 identifier: 0x0006109e
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048   159385599    79691776   83  Linux
    /dev/sda2       159387646   167770111     4191233    5  Extended
    /dev/sda5       159387648   167770111     4191232   82  Linux swap / Solaris
    
    Disk /dev/sdb: 214.7 GB, 214748364800 bytes
    255 heads, 63 sectors/track, 26108 cylinders, total 419430400 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 identifier: 0x00000000
    
    Disk /dev/sdb doesn't contain a valid partition table
    xxx@xxx:/dev$ sudo fdisk /dev/sdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel with disk identifier 0xdc2cc610.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.
    
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    Command (m for help): m
    Command action
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       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): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-419430399, default 2048): 
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): 
    Using default value 419430399
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.

    格式化 & 挂载硬盘 & 开机自动挂载

    For Ubuntu (14.04)

    xxx@xxx:/$ df -T /dev/sda1
    Filesystem     Type 1K-blocks    Used Available Use% Mounted on
    /dev/sda1      ext4  78310344 5329308  68980064   8% /
    xxx@xxx:/$ sudo mkfs.ext4 /dev/sdb1
    mke2fs 1.42.9 (4-Feb-2014)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    13107200 inodes, 52428544 blocks
    2621427 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    1600 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    	4096000, 7962624, 11239424, 20480000, 23887872
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done     
    
    xxx@xxx:/$ sudo mkdir xhome
    xxx@xxx:/$ sudo mount /dev/sdb1 /xhome
    xxx@xxx:/$ sudo vim /etc/fstab # edit file fstab according to the file's original contents.
    xxx@xxx:/$ sudo mount -a  #check if the disk is mounted correctly.
  • 相关阅读:
    html5快速入门(四)—— JavaScript
    SJPullDownMenu下拉菜单框架使用
    HTML5快速入门(三)—— 标签综合运用
    html5快速入门(二)—— CSS简介
    html5快速入门(一)—— html简介
    Robotium测试套管理测试用例
    从GitHub远程仓库中删除文件夹或文件
    上传本地代码到GitHub
    Jenkins关联GitHub进行构建
    Jenkins忘记用户名密码
  • 原文地址:https://www.cnblogs.com/chinshing/p/4043505.html
Copyright © 2020-2023  润新知