How to add a hard disk to linux

Source: Internet
Author: User

How to add a hard disk overview to linux: Add a 15 GB hard disk 170 fdisk-l to list all hard disks 171 sudo pvcreate/dev/sdb ---------- sdb is the newly added physical disk, prepare for lvm to use 172 sudo vgcreate 12c/dev/sdb ----------------- to create a volume group named 12c 174 sudo lvcreate-l 100% FREE-n 12clv 12c volume to create a logical volume named 12lv 175 sudo mkfs -t ext4/dev/12c/12clv ------------------------ create a file system 176 sudo mkdir/12c -------------------------- create a mount point 177 sudo vi/etc/fs Tab ------------------------- set the mount option. mount point 178 sudo mount/12c ------------------------ mount the file system. For example: [root @ localhost ~] # Fdisk-lDisk/dev/sda: 14.3 GB, 14343061504 bytes255 heads, 63 sectors/track, 1743 cylindersUnits = cylinders of 16065*512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83 Linux/dev/sda2 14 1743 13896225 8e Linux LVMDisk/dev /sdb: 16.1 GB, 16106127360 bytes255 heads, 63 sectors/track, 1958 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDisk/dev/sdb doe Sn't contain a valid partition tableDisk/dev/dm-0: 13.1 GB, 13153337344 bytes255 heads, 63 sectors/track, 1599 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDisk/dev/dm-0 doesn't contain a valid partition tableDisk/dev/dm-1: 1073 MB, 1073741824 bytes255 heads, 63 sectors/track, 130 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDisk/dev/dm-1 doesn't contain a valid partiti On table [root @ localhost ~] # Sudo pvcreate/dev/sdb Writing physical volume data to disk "/dev/sdb" Physical volume "/dev/sdb" successfully created [root @ localhost ~] # Sudo vgcreate 12c/dev/sdb Volume group "12c" successfully created [root @ localhost ~] # Sudo lvcreate-l 100% FREE-n 12clv Path required for Logical Volume "12clv" Please provide a volume group name Run 'lvcreate -- help' for more information. [root @ localhost ~] # Sudo lvcreate-l 100% FREE-n 12clv 12c Logical volume "12clv" created [root @ localhost ~] # Sudo mkfs-t ext4/dev/12c/12clvmke4fs 1.41.12 (17-May-2010) Filesystem label = OS type: LinuxBlock size = 4096 (log = 2) fragment size = 4096 (log = 2) Stride = 0 blocks, Stripe width = 0 blocks983040 inodes, 3931136 blocks196556 blocks (5.00%) reserved for the super userFirst data block = 0 Maximum filesystem blocks = 4026531840120 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSup Erblock backups stored on blocks: 32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208 Writing inode tables: done Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 22 mounts or180 days, whichever comes first. use tune4fs-c or-I to override. [root @ localhost ~] # Sudo mkdir/12c [root @ localhost ~] # Sudo vi/etc/fstab/dev/VolGroup00/LogVol00/ext3 defaults 1 1 LABEL =/boot ext3 defaults 1 2 tmpfs/dev/shm tmpfs defaults 0 0 devpts/dev /pts devpts gid = 5, mode = 620 0 0 sysfs/sys sysfs defaults 0 0 proc/proc defaults 0 0/dev/VolGroup00/LogVol01 swap defaults 0 0/dev/12c/12clv/12c ext4 defaults 0 0 ~~ "/Etc/fstab" 8L, 610C written [root @ localhost ~] # Sudo mount/12c [root @ localhost ~] # Cd/[root @ localhost/] # lltotal 166drwxr-xr-x 3 root 4096 Jun 26 then 3 root 4096 Jun 20 04 bindrwxr-xr-x 4 root 1024 Jun 19 bootdrwxr -xr-x 13 root 3900 Jun 26 devdrwxr-xr-x 98 root 12288 Jun 26 etcdrwxr-xr-x 4 root 4096 Jun 26 homedrwxr-xr-x 11 root 4096 Jun 20 libdrwxr-xr-x 9 root 4096 Jun 20 04 lib64drwx ------ 2 root 16384 Jun 19 lost + founddrwxr-xr-x 3 root 4096 Jun 26 mediadrwxr-xr-x 2 root 0 Jun 26 miscdrwxr-xr-x 2 root 4096 Feb 16 2010 mntdrwxr-xr-x 2 root 0 Jun 26 netdrwxr- xr-x 2 root 4096 Feb 16 2010 optdr-xr-x 123 root 0 Jun 26 procdrwxr-x --- 15 root 4096 Jun 26 rootdrwxr-xr-x 2 root 12288 Jun 20 sbindrwxr-xr-x 2 root 4096 Jun 19 selinuxdrwxr-xr-x 2 root 4096 Feb 16 2010 srvdrwxr-xr-x 13 root 0 jun 26 sysdrwxr-xr-x 3 root 4096 Jun 19 tftpbootdrwxrwxrwt 8 root 4096 Jun 26 19 tmpdrwxr-xr-x 15 root 4096 Jun 19 usrdrwxr-xr-x 21 root 4096 Jun 19 var [root @ localhost/] # df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/VolGroup00-LogVol00 12G 8.7G 2.6G 78% // dev/sda1 99 M 24 M 71 M 25%/boottmpfs 244 M 0 244 M 0%/dev/shm/dev/mapper/12c-12clv 15G 166 M 14G 2%/12c [root @ localhost/] # cd/12c [root @ localhost 12c] # df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/VolGroup00-LogVol00 12G 8.7G 2.6G 78%/dev /sda1 99 M 24 M 71 M 25%/boottmpfs 244 M 0 244 M 0%/dev/shm/dev/mapper/12c-12clv 15G 166 M 14G 2%/12c [root @ localhost 12c] # a hard disk is successfully added here, create a File System

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.