User Tools

Site Tools


adding_a_new_hardrive_to_a_linux_system

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

adding_a_new_hardrive_to_a_linux_system [2015/07/09 23:24] (current)
admin created
Line 1: Line 1:
 +  * **Finding the new hardrive**
  
 +<​code>​
 +# ls /dev/sd*
 +/​dev/​sda ​ /​dev/​sda1 ​ /dev/sda2
 +
 +# ls /dev/sd*
 +/dev/sda /dev/sda1 /dev/sda2 /dev/sdb
 +</​code>​
 +
 +  * **Creating Linux Partitions**
 +
 +<​code>​
 +# su -
 +# 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 0xd1082b01.
 +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)
 +
 +WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
 +         ​switch off the mode (command '​c'​) and change display units to
 +         ​sectors (command '​u'​).
 +
 +Command (m for help):
 +</​code>​
 +
 +<​code>​
 +Command (m for help): c
 +DOS Compatibility flag is not set
 +Command (m for help): u
 +Changing display/​entry units to sectors
 +</​code>​
 +
 +<​code>​
 +Command (m for help): p
 +
 +Disk /dev/sdb: 34.4 GB, 34359738368 bytes
 +255 heads, 63 sectors/​track,​ 4177 cylinders
 +Units = cylinders of 16065 * 512 = 8225280 bytes
 +Sector size (logical/​physical):​ 512 bytes / 512 bytes
 +I/O size (minimum/​optimal):​ 512 bytes / 512 bytes
 +Disk identifier: 0xd1082b01
 +
 +   ​Device Boot      Start         ​End ​     Blocks ​  ​Id ​ System
 +</​code>​
 +
 +<​code>​
 +Command (m for help): n
 +Command action
 +   ​e ​  ​extended
 +   ​p ​  ​primary partition (1-4)
 +p
 +Partition number (1-4):
 +</​code>​
 +
 +<​code>​
 +Command (m for help): w
 +The partition table has been altered!
 +
 +Calling ioctl() to re-read partition table.
 +Syncing disks.
 +</​code>​
 +
 +List again for see change :
 +
 +<​code>​
 +# ls /dev/sd*
 +/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1
 +</​code>​
 +
 +  * **Creating a File System - Disk Partition**
 +<​code>​
 +# /​sbin/​mkfs.ext4 -L /backup /dev/sdb1
 +mke2fs 1.41.12 (17-May-2010)
 +Filesystem label=/​backup
 +OS type: Linux
 +Block size=4096 (log=2)
 +Fragment size=4096 (log=2)
 +Stride=0 blocks, Stripe width=0 blocks
 +2097152 inodes, 8388352 blocks
 +419417 blocks (5.00%) reserved for the super user
 +First data block=0
 +Maximum filesystem blocks=4294967296
 +256 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
 +
 +Writing inode tables: done
 +Creating journal (32768 blocks): done
 +Writing superblocks and filesystem accounting information:​ done
 +
 +This filesystem will be automatically checked every 36 mounts or
 +180 days, whichever comes first. ​ Use tune2fs -c or -i to override.
 +</​code>​
 +
 +  * **Mounting a File System**
 +<​code>​
 +$mkdir /anyfolder
 +$mount /dev/sdb1 /backup
 +</​code>​
 +Show all mounts : 
 +<​code>​$mount</​code>​
 +
 +  * **Configuring CentOS 6 to Automatically Mount a File System**
 +
 +<​code>​
 +$nano /​etc/​fstab</​code>​
 +
 +Example : 
 +<​code>​
 +/​dev/​mapper/​vg_centos6-lv_root /            ext4    defaults ​       1 1
 +UUID=0d06ebad-ea73-48ad-a50a-1b3b8ef24491 /boot  ext4    defaults ​       1 2
 +/​dev/​mapper/​vg_centos6-lv_swap swap         ​swap ​   defaults ​       0 0
 +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               ​proc ​   defaults ​       0 0
 +LABEL=/​anyfolder /​anyfolder ​     ext4    defaults ​       1 2
 +</​code>​
 +
 +Source : [[http://​www.techotopia.com/​index.php/​Adding_a_New_Disk_Drive_to_a_CentOS_6_System|External Link]]
adding_a_new_hardrive_to_a_linux_system.txt ยท Last modified: 2015/07/09 23:24 by admin