1. HDD 추가
VBox HDD 2개 추가
2. 파티션 분할
# fdisk
fdisk: Usage:
fdisk [options] <disk> change partition table
fdisk [options] -l <disk> list partition table(s)
fdisk -s <partition> give partition size(s) in blocks
Options:
-b <size> sector size (512, 1024, 2048 or 4096)
-c switch off DOS-compatible mode
-h print help
-u <size> give sizes in sectors instead of cylinders
-v print version
-C <number> specify the number of cylinders
-H <number> specify the number of heads
-S <number> specify the number of sectors per track
# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x000a26c1
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 396 3072000 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 396 651 2048000 83 Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4 651 1045 3165184 5 Extended
/dev/sda5 651 715 512000 83 Linux
/dev/sda6 715 779 512000 83 Linux
/dev/sda7 779 804 204800 83 Linux
/dev/sda8 804 1045 1932288 82 Linux swap / Solaris
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x00000000
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x00000000
# fdisk -l /dev/sdb
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x00000000
# fdisk /dev/sdb
:
:
Command (m for help): m
d delete a partition
l list known partition types
n add a new partition
p print the partition table
q quit without saving changes
w write table to disk and exit
첫 번째 파티션을 분할한다.
Command (m for help): n -> p -> 1 -> 엔터 -> +4G -> p
두 번째 파티션을 분할한다.
Command (m for help): n -> p -> 2 -> 엔터 -> 엔터
분할된 파티션 정보를 출력한다.
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x33611fca
Device Boot Start End Blocks Id System
/dev/sdb1 1 523 4200966 83 Linux
/dev/sdb2 524 1044 4184932+ 83 Linux
w 를 눌러서 분할된 파티션을 저장하고 종료한다.
Command (m for help): w
fdisk -l 로 다시 확인하면 두 개의 파티션이 분할된 부분이 보여진다.
# fdisk -l /dev/sdb
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x33611fca
Device Boot Start End Blocks Id System
/dev/sdb1 1 523 4200966 83 Linux
/dev/sdb2 524 1044 4184932+ 83 Linux
3. 파일시스템 생성
- mke2fs -j 옵션 : ext3 파일시스템으로 포맷)
- mkfs.ext4 : ext4 파일시스템으로 포맷)
# mkfs.ext4 /dev/sdb1
:
:(생략)
# mkfs.ext4 /dev/sdb2
:
:(생략)
4. 마운트 (-t 옵션 : 파일시스템의 종류를 선택)
--------------------------------------------------
ex) mount --help
-t vfat , -t ext3 , -t iso9660
-o ro
# mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
# mount -t ext4 /dev/sdb1 /home/data
--------------------------------------------------
# mkdir /mnt/hdd1 /mnt/hdd2
# ls /mnt
hdd1 hdd2
# mount /dev/sdb1 /mnt/hdd1
# mount /dev/sdb2 /mnt/hdd2
5. 마운트 확인
# mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/sda7 on /home type ext4 (rw)
/dev/sda5 on /tmp type ext4 (rw)
/dev/sda3 on /usr type ext4 (rw)
/dev/sda6 on /var type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sdb1 on /mnt/hdd1 type ext4 (rw) <--
/dev/sdb2 on /mnt/hdd2 type ext4 (rw) <--
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 2958224 278024 2526600 10% /
tmpfs 510024 0 510024 0% /dev/shm
/dev/sda1 95054 31801 58133 36% /boot
/dev/sda7 194241 1552 182449 1% /home
/dev/sda5 487652 2322 459730 1% /tmp
/dev/sda3 1983056 398452 1482204 22% /usr
/dev/sda6 487652 25438 436614 6% /var
/dev/sdb1 4003828 8216 3785564 1% /mnt/hdd1 <--
/dev/sdb2 4053668 8184 3836240 1% /mnt/hdd2 <--
6. 자동 마운트 설정 (여기서는 방법2를 이용한다)
방법1 : /etc/rc.local 파일에 mount 정보를 넣으면 된다.
방법2 : /etc/fstab 파일에 mount 정보를 넣으면 된다.
# vi /etc/fstab
-- /etc/fstab --
:
:(생략)
proc /proc proc defaults 0 0
/dev/sdb1 /mnt/hdd1 ext4 defaults 1 2
/dev/sdb2 /mnt/hdd2 ext4 defaults 1 2
-- /etc/fstab --
리부팅 후 에 자동으로 마운트가 되는 확인한다.
로그인 후 df 로 확인했을 때 /mnt/hdd1, /mnt/hdd2 가 올라오면 성공
# reboot
로그인 후
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 2958224 278028 2526596 10% /
tmpfs 510024 0 510024 0% /dev/shm
/dev/sda1 95054 31801 58133 36% /boot
/dev/sda7 194241 1552 182449 1% /home
/dev/sda5 487652 2322 459730 1% /tmp
/dev/sda3 1983056 398452 1482204 22% /usr
/dev/sda6 487652 25496 436556 6% /var
/dev/sdb1 4003828 8216 3785564 1% /mnt/hdd1 <--
/dev/sdb2 4053668 8184 3836240 1% /mnt/hdd2 <--
'Server > Linux' 카테고리의 다른 글
신규 HDD 추가하기 (0) | 2018.07.06 |
---|---|
파티션 분할 하기 (0) | 2018.07.05 |
심볼릭 링크 하드링크 (0) | 2018.07.05 |
리눅스 기본 설명 (0) | 2018.07.05 |
쉘스크립트 (0) | 2018.07.04 |