블로그 이미지
은총애비!!

카테고리

분류 전체보기 (2521)
Linux (35)
Error 해결 방법 (5)
소소한 일상 (1616)
사진실 (0)
책책책, 책을 읽읍시다!! (21)
기타(JSP & DB & 등등) (4)
미국 주식 관련 (541)
아침형 인간 프로젝트 (292)
Total
Today
Yesterday
반응형

[MicroServer G7 N54L] VMWARE에서 HDD 추가 / 마운트 까지...

 

우선 Power Off 합니다. 그리고

상단 메뉴중 VM -> Setting (CTRL + D) -> ADD -> Hard Disk -> Next -> Next -> Next -> 용량 선택 -> Finish

이렇게 하면 HDD는 추가 한겁니다.

 

다시 Power On.

 

그리고 ssh로 접속해서 fdisk -l 을 하면 아래와 같이 나옵니다.

fdisk -l 현재 장착되어 있는 disk를 보여주는 명령어 입니다.

 

[root@localhost qual]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x0000f560

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1045     8387584   83  Linux
/dev/sda2            1045        2350    10485760   83  Linux
/dev/sda3            2350        2611     2097152   82  Linux swap / Solaris

Disk /dev/sdb: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table
[root@localhost qual]#

[root@localhost qual]# 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 0x996eed0e.
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):

 

n => 새로운 파티션을 만듭니다.

- p => 기본 파티션 생성

- e => 확장 파티션 생성

w => 파티션 테이블 설정 저장

 

[root@localhost qual]# 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 0xd4f54031.
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): n => 새로운 파티션 생성
Command action
   e   extended
   p   primary partition (1-4)
p => 기본 파티션 생성
Partition number (1-4): 1 => 파티션 번호
First cylinder (1-102, default 1):
Using default value 1  => 하드디스크 용량 시작점.
Last cylinder, +cylinders or +size{K,M,G} (1-102, default 102):
Using default value 102  => 하드디스크 용량 끝. (100메가 하드 디스크 추가)

Command (m for help): w => 파티션 테이블 설정 저장(위에 설정한것 저장)
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost qual]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x0000f560

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1045     8387584   83  Linux
/dev/sda2            1045        2350    10485760   83  Linux
/dev/sda3            2350        2611     2097152   82  Linux swap / Solaris

Disk /dev/sdb: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd4f54031

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         102      104432   83  Linux      => 추가로 /dev/sdb1로 생성됨.
[root@localhost qual]#

 

마지막에 w를 하고 파티션 설정을 꼭 저장해야 됩니다.

이제 디스크를 추가 했으니 사용하기전에 포멧을 해야합니다.

 

파일 시스템 포멧 명령어

mkfs -t [파일 시스템] [파티션 경로]

ex) 파일 시스템(ext3/ext4 등등등)

[root@localhost /]# mkfs -t ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
26208 inodes, 104432 blocks
5221 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
2016 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729

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

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost /]#

 

파일 시스템 확인 명령어

file -s [파티션 경로]

[root@localhost /]# file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)
[root@localhost /]#

 

이제 파티션을 추가하고 포멧도 했습니다.

추가한 하드를 쓰려면 이제 마운트(MOUNT) 하면 됩니다.

 

마운트를 하기위해 디렉토리를 만듭니다.

[root@localhost /]# mkdir Backup
[root@localhost /]# ls
Backup  bin  boot  cgroup  dev  etc  home  lib  lost+found  media  misc  mnt  net  opt  proc  root  sbin  selinux  srv  sys  tmp  usr  var
[root@localhost /]#

 

마운트 명령어

mount [파티션 경로] [마운트 할 경로]

[root@localhost /]# mount -t ext4 /dev/sdb1 /Backup

 

마운트 정보 확인

df -h

[root@localhost /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.8G  3.7G  3.7G  51% /
tmpfs                 504M   72K  504M   1% /dev/shm
/dev/sda2             9.8G   24M  9.2G   1% /home
[root@localhost /]# mount /dev/sdb1 /Backup
[root@localhost /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.8G  3.7G  3.7G  51% /
tmpfs                 504M   72K  504M   1% /dev/shm
/dev/sda2             9.8G   24M  9.2G   1% /home
/dev/sdb1              95M  1.6M   87M   2% /Backup    => mount로 새롭게 추가!!
[root@localhost /]#

이렇게 하면 끝!!!

 

하지만!! 이건 일시적인것 뿐...

재부팅을 하면 마운트를 다시 해야 합니다.

재시작을 해도 마운트가 풀리지 않도록 fstab에 등록하면 됩니다.

vi /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Oct  4 20:51:39 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=cba4e03b-05d6-4b79-ace8-8955caf5f295 /                       ext4    defaults        1 1
UUID=d316c840-a6c0-443f-b5cd-64a1c0eded2d /home                   ext4    defaults        1 2
UUID=25c07c8b-002b-43a8-ab41-a7790ec6307d swap                    swap    defaults        0 0
/dev/sdb1               /Backup                 ext4    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

반응형
Posted by 은총애비!!
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함