• 흐림동두천 2.2℃
  • 흐림강릉 1.4℃
  • 구름많음서울 2.4℃
  • 구름많음대전 3.3℃
  • 흐림대구 5.9℃
  • 흐림울산 5.2℃
  • 구름많음광주 4.5℃
  • 구름많음부산 6.3℃
  • 구름많음고창 0.8℃
  • 흐림제주 8.7℃
  • 구름많음강화 -1.0℃
  • 구름많음보은 1.3℃
  • 구름많음금산 1.9℃
  • 흐림강진군 5.0℃
  • 흐림경주시 3.8℃
  • 구름많음거제 7.6℃
기상청 제공

linux에서 하드디스크 추가하기

[root@ktoplogapdev03 ~]# fdisk -l

Disk /dev/xvda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1         131     1052226   83  Linux
/dev/xvda2             132        4047    31455270   83  Linux
/dev/xvda3            4048        6658    20972857+  83  Linux
/dev/xvda4            6659       13054    51375870    5  Extended
/dev/xvda5            6659        9269    20972826   83  Linux
/dev/xvda6            9270       11880    20972826   83  Linux
/dev/xvda7           11881       12924     8385898+  82  Linux swap / Solaris
/dev/xvda8           12925       13054     1044193+  8e  Linux LVM

Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table
[root@ktoplogapdev03 ~]# mount /dev/xvdb /ktop
mount: you must specify the filesystem type
[root@ktoplogapdev03 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda6            20315812    485904  18781268   3% /
/dev/xvda5            20315812   2617592  16649580  14% /usr
/dev/xvda3            20315844    237836  19029368   2% /var
/dev/xvda2            30470176    176604  28720812   1% /home
/dev/xvda1             1019208     41664    924936   5% /boot
tmpfs                  8388608         0   8388608   0% /dev/shm
[root@ktoplogapdev03 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda6             20G  475M   18G   3% /
/dev/xvda5             20G  2.5G   16G  14% /usr
/dev/xvda3             20G  233M   19G   2% /var
/dev/xvda2             30G  173M   28G   1% /home
/dev/xvda1            996M   41M  904M   5% /boot
tmpfs                 8.0G     0  8.0G   0% /dev/shm
[root@ktoplogapdev03 ~]# vi /etc/fstab

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/boot             /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                   proc    defaults        0 0
LABEL=SWAP-xvda7        swap                    swap    defaults        0 0
~                                                                                            
~                                                                                            
~                                                                                            
~                                                                                            
~                                                                                            
~                                                                                            
~                                                                                            
~                                                                                            
[root@ktoplogapdev03 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda6            20315812    485904  18781268   3% /
/dev/xvda5            20315812   2617592  16649580  14% /usr
/dev/xvda3            20315844    237836  19029368   2% /var
/dev/xvda2            30470176    176604  28720812   1% /home
/dev/xvda1             1019208     41664    924936   5% /boot
tmpfs                  8388608         0   8388608   0% /dev/shm
[root@ktoplogapdev03 ~]# fdisk -l

Disk /dev/xvda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1         131     1052226   83  Linux
/dev/xvda2             132        4047    31455270   83  Linux
/dev/xvda3            4048        6658    20972857+  83  Linux
/dev/xvda4            6659       13054    51375870    5  Extended
/dev/xvda5            6659        9269    20972826   83  Linux
/dev/xvda6            9270       11880    20972826   83  Linux
/dev/xvda7           11881       12924     8385898+  82  Linux swap / Solaris
/dev/xvda8           12925       13054     1044193+  8e  Linux LVM

Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table
[root@ktoplogapdev03 ~]# fdisk /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 26108.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-26108, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-26108, default 26108):
Using default value 26108

Command (m for help): p

Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1       26108   209712478+  83  Linux

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@ktoplogapdev03 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda6            20315812    485904  18781268   3% /
/dev/xvda5            20315812   2617592  16649580  14% /usr
/dev/xvda3            20315844    237836  19029368   2% /var
/dev/xvda2            30470176    176604  28720812   1% /home
/dev/xvda1             1019208     41664    924936   5% /boot
tmpfs                  8388608         0   8388608   0% /dev/shm
[root@ktoplogapdev03 ~]# mkfs
mkfs         mkfs.cramfs  mkfs.ext2    mkfs.ext3    mkfs.msdos   mkfs.vfat    
[root@ktoplogapdev03 ~]# mkfs
mkfs         mkfs.cramfs  mkfs.ext2    mkfs.ext3    mkfs.msdos   mkfs.vfat    
[root@ktoplogapdev03 ~]# mkfs.ext3 /dev/xvdb
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
26214400 inodes, 52428800 blocks
2621440 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
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@ktoplogapdev03 ~]#
[root@ktoplogapdev03 ~]#
[root@ktoplogapdev03 ~]#
[root@ktoplogapdev03 ~]# ll
total 64
-rw------- 1 root root  1182 Sep 22  2011 anaconda-ks.cfg
-rw-r--r-- 1 root root 38582 Sep 22  2011 install.log
-rw-r--r-- 1 root root     0 Sep 22  2011 install.log.syslog
drwxr-xr-x 2 root root  4096 Apr 18 14:04 ktds
[root@ktoplogapdev03 ~]# cd /
[root@ktoplogapdev03 /]# ll
total 164
drwxr-xr-x   2 root root  4096 Apr 17 18:05 bin
drwxr-xr-x   4 root root  4096 Sep 22  2011 boot
drwxr-xr-x  10 root root  3060 Apr 19 19:13 dev
drwxr-xr-x 100 root root 12288 Apr 19 19:12 etc
drwxr-xr-x   6 root root  4096 Apr 18 11:10 home
drwxr-xr-x   2 root root  4096 Apr 19 19:12 ktop
drwxr-xr-x  11 root root  4096 Apr 17 18:05 lib
drwxr-xr-x   7 root root  4096 Apr 17 18:05 lib64
drwx------   2 root root 16384 Sep 22  2011 lost+found
drwxr-xr-x   2 root root  4096 Jan 27  2010 media
drwxr-xr-x   2 root root     0 Apr 18 13:54 misc
drwxr-xr-x   2 root root  4096 Jan 27  2010 mnt
drwxr-xr-x   2 root root     0 Apr 18 13:54 net
drwxr-xr-x   2 root root  4096 Jan 27  2010 opt
dr-xr-xr-x 123 root root     0 Apr 18 13:53 proc
drwxr-x---   5 root root  4096 Apr 18 10:36 root
drwxr-xr-x   2 root root 12288 Apr 17 18:05 sbin
drwxr-xr-x   2 root root  4096 Sep 22  2011 selinux
drwxr-xr-x   2 root root  4096 Jan 27  2010 srv
drwxr-xr-x  12 root root     0 Apr 18 13:53 sys
drwxrwxrwt   4 root root  4096 Apr 19 19:12 tmp
drwxr-xr-x  16 root root  4096 Sep 22  2011 usr
drwxr-xr-x  23 root root  4096 Sep 22  2011 var
[root@ktoplogapdev03 /]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda6            20315812    485904  18781268   3% /
/dev/xvda5            20315812   2617592  16649580  14% /usr
/dev/xvda3            20315844    237836  19029368   2% /var
/dev/xvda2            30470176    176604  28720812   1% /home
/dev/xvda1             1019208     41664    924936   5% /boot
tmpfs                  8388608         0   8388608   0% /dev/shm
[root@ktoplogapdev03 /]# fdisk -l

Disk /dev/xvda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1         131     1052226   83  Linux
/dev/xvda2             132        4047    31455270   83  Linux
/dev/xvda3            4048        6658    20972857+  83  Linux
/dev/xvda4            6659       13054    51375870    5  Extended
/dev/xvda5            6659        9269    20972826   83  Linux
/dev/xvda6            9270       11880    20972826   83  Linux
/dev/xvda7           11881       12924     8385898+  82  Linux swap / Solaris
/dev/xvda8           12925       13054     1044193+  8e  Linux LVM

Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table
[root@ktoplogapdev03 /]# mount /dev/xvdb /ktop
[root@ktoplogapdev03 /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda6             20G  475M   18G   3% /
/dev/xvda5             20G  2.5G   16G  14% /usr
/dev/xvda3             20G  233M   19G   2% /var
/dev/xvda2             30G  173M   28G   1% /home
/dev/xvda1            996M   41M  904M   5% /boot
tmpfs                 8.0G     0  8.0G   0% /dev/shm
/dev/xvdb             197G  188M  187G   1% /ktop
[root@ktoplogapdev03 /]#
[root@ktoplogapdev03 /]#
[root@ktoplogapdev03 /]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda6            20315812    485904  18781268   3% /
/dev/xvda5            20315812   2617592  16649580  14% /usr
/dev/xvda3            20315844    237836  19029368   2% /var
/dev/xvda2            30470176    176604  28720812   1% /home
/dev/xvda1             1019208     41664    924936   5% /boot
tmpfs                  8388608         0   8388608   0% /dev/shm
/dev/xvdb            206424760    191892 195747108   1% /ktop
[root@ktoplogapdev03 /]# vi /etc/fstab

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
/dev/xvdb               /ktop                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-xvda7        swap                    swap    defaults        0 0
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
~                                                                                                    
"/etc/fstab" 11L, 797C written
[root@ktoplogapdev03 /]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda6            20315812    485904  18781268   3% /
/dev/xvda5            20315812   2617592  16649580  14% /usr
/dev/xvda3            20315844    237836  19029368   2% /var
/dev/xvda2            30470176    176604  28720812   1% /home
/dev/xvda1             1019208     41664    924936   5% /boot
tmpfs                  8388608         0   8388608   0% /dev/shm
/dev/xvdb            206424760    191892 195747108   1% /ktop
[root@ktoplogapdev03 /]# end
-bash: end: command not found