[Draft] attach a new hard disk.

Source: Internet
Author: User

[Draft] attach a new hard disk.

View new disks & create partitions

xxx@xxx:/dev$ sudo fdisk -l[sudo] password for xxx: Disk /dev/sda: 85.9 GB, 85899345920 bytes255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk 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 / SolarisDisk /dev/sdb: 214.7 GB, 214748364800 bytes255 heads, 63 sectors/track, 26108 cylinders, total 419430400 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sdb doesn't contain a valid partition tablexxx@xxx:/dev$ sudo fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding 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): mCommand 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): nPartition type:   p   primary (0 primary, 0 extended, 4 free)   e   extendedSelect (default p): pPartition number (1-4, default 1): 1First sector (2048-419430399, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): Using default value 419430399Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.

 

Format & Mount hard disk & auto mount upon startup

For Ubuntu (14.04)

xxx@xxx:/$ df -T /dev/sda1Filesystem     Type 1K-blocks    Used Available Use% Mounted on/dev/sda1      ext4  78310344 5329308  68980064   8% /xxx@xxx:/$ sudo mkfs.ext4 /dev/sdb1mke2fs 1.42.9 (4-Feb-2014)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks13107200 inodes, 52428544 blocks2621427 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=42949672961600 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872Allocating group tables: done                            Writing inode tables: done                            Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done     xxx@xxx:/$ sudo mkdir xhomexxx@xxx:/$ sudo mount /dev/sdb1 /xhomexxx@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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.