1. 디스크추가
2. fdisk -l --현재연결되어있는 하드디스크 확인
[root@localhost ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 650 5116702+ 83 Linux
/dev/sda3 651 1287 5116702+ 83 Linux
/dev/sda4 1288 2610 10626997+ 5 Extended
/dev/sda5 1288 1542 2048256 82 Linux swap / Solaris
/dev/sda6 1543 1669 1020096 83 Linux
/dev/sda7 1670 2610 7558551 83 Linux
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table --파티션작업 안해서 사용할수 없음.
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 650 5116702+ 83 Linux
/dev/sda3 651 1287 5116702+ 83 Linux
/dev/sda4 1288 2610 10626997+ 5 Extended
/dev/sda5 1288 1542 2048256 82 Linux swap / Solaris
/dev/sda6 1543 1669 1020096 83 Linux
/dev/sda7 1670 2610 7558551 83 Linux
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table --파티션작업 안해서 사용할수 없음.
3. fdisk 명령어로 /dev/sdb를 10GB 두개로 분할
[root@localhost ~]# fdisk /dev/sdb
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 2610.
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): n -- new, 신규생성
Command action
e extended
p primary partition (1-4)
p -- extended / primary 선택
Partition number (1-4): 1 --주파티션번호
First cylinder (1-2610, default 1): 1 -- 시작실린더 번호
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +10G -- 용량지정, 단위 대문자로
Command (m for help): p -- 확인
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1217 9775521 83 Linux
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 2610.
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): n -- new, 신규생성
Command action
e extended
p primary partition (1-4)
p -- extended / primary 선택
Partition number (1-4): 1 --주파티션번호
First cylinder (1-2610, default 1): 1 -- 시작실린더 번호
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +10G -- 용량지정, 단위 대문자로
Command (m for help): p -- 확인
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1217 9775521 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1218-2610, default 1218): --엔터치면 알아서
Using default value 1218
Last cylinder or +size or +sizeM or +sizeK (1218-2610, default 2610): --엔터치면 남은용량 모두 할당
Using default value 2610
Command (m for help): p
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1217 9775521 83 Linux
/dev/sdb2 1218 2610 11189272+ 83 Linux
Command (m for help): w -- 저장/ solaris : label
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1218-2610, default 1218): --엔터치면 알아서
Using default value 1218
Last cylinder or +size or +sizeM or +sizeK (1218-2610, default 2610): --엔터치면 남은용량 모두 할당
Using default value 2610
Command (m for help): p
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1217 9775521 83 Linux
/dev/sdb2 1218 2610 11189272+ 83 Linux
Command (m for help): w -- 저장/ solaris : label
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4. 파티션 완료된 디스크를 포맷
[root@localhost ~]# mkfs.ext3 /dev/sdb1 --파티션1 포맷 / solaris : newfs
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1224000 inodes, 2443880 blocks
122194 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2503999488
75 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1224000 inodes, 2443880 blocks
122194 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2503999488
75 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkfs.ext3 /dev/sdb2 --파티션2 포맷
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1400768 inodes, 2797318 blocks
139865 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2864709632
86 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1400768 inodes, 2797318 blocks
139865 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2864709632
86 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5. 디렉토리 생성후 마운트
[root@localhost /]# mkdir /dir1
[root@localhost /]# mkdir /dir2
[root@localhost /]# mount /dev/sdb1 /dir1
[root@localhost /]# mount /dev/sdb2 /dir2
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 4.8G 3.0G 1.6G 65% /
/dev/sda7 7.0G 145M 6.5G 3% /app
/dev/sda6 965M 72M 844M 8% /var
/dev/sda2 4.8G 138M 4.4G 4% /home
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/sdb1 9.2G 150M 8.6G 2% /dir1
/dev/sdb2 11G 155M 9.9G 2% /dir2
[root@localhost /]# mkdir /dir2
[root@localhost /]# mount /dev/sdb1 /dir1
[root@localhost /]# mount /dev/sdb2 /dir2
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 4.8G 3.0G 1.6G 65% /
/dev/sda7 7.0G 145M 6.5G 3% /app
/dev/sda6 965M 72M 844M 8% /var
/dev/sda2 4.8G 138M 4.4G 4% /home
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/sdb1 9.2G 150M 8.6G 2% /dir1
/dev/sdb2 11G 155M 9.9G 2% /dir2
6. 재부팅 후에도 유지되도록 /etc/fstab 파일에 등록
[root@localhost /]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/app /app 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-sda5 swap swap defaults 0 0
/dev/sdb1 /dir1 ext3 defaults 1 2
/dev/sdb2 /dir2 ext3 defaults 1 2
LABEL=/ / ext3 defaults 1 1
LABEL=/app /app 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-sda5 swap swap defaults 0 0
/dev/sdb1 /dir1 ext3 defaults 1 2
/dev/sdb2 /dir2 ext3 defaults 1 2
'os > Linux' 카테고리의 다른 글
[실습] shell script (0) | 2014.10.28 |
---|---|
[실습] 2. LVM & RAID (0) | 2014.10.28 |
9. 네트워크 (서브넷 정리 필요) (0) | 2014.10.28 |
8. Shell Script - 조건문, 반복문 (0) | 2014.10.28 |
7. Shell Script (0) | 2014.10.28 |
댓글