디스크 포맷이 안되네요

원래 120기가짜리를 쓰고 있었는데… 오류가 나서
재설치를 하려니 자꾸 실패가 떠서 80기가짜리를 추가로 장착하고 80기가짜리에 설치를 했습니다.
120기가짜리에는 파티션도 나뉘어져 있고 그런 상황입니다.

그래서 120기가짜리를 포맷하고 /home2로 마운트 하고 싶어서

root@ubuntu:~# mkfs.ext4 /dev/sda
mke2fs 1.41.14 (22-Dec-2010)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/sda is apparently in use by the system; will not make a filesystem here!

이렇게 뜹니다.
그래서 장치현황을 봤는데
root@ubuntu:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root
74642608 2193964 68656980 4% /
udev 1023620 4 1023616 1% /dev
tmpfs 412368 240 412128 1% /run
none 5120 0 5120 0% /run/lock
none 1030912 0 1030912 0% /run/shm
/dev/sdb1 233191 23485 197265 11% /boot

라고 나옵니다.

fdisk -l 은
root@ubuntu:~# fdisk -l

Disk /dev/sda: 120.1 GB, 120060444672 bytes
255 heads, 63 sectors/track, 14596 cylinders, total 234493056 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d9489

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 230301695 115149824 83 Linux
/dev/sda2 230303742 234491903 2094081 5 Extended
/dev/sda5 230303744 234491903 2094080 82 Linux swap / Solaris

Disk /dev/sdb: 80.1 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders, total 156368016 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00083771

Device Boot Start End Blocks Id System
/dev/sdb1 2048 499711 248832 83 Linux
/dev/sdb2 501758 156366847 77932545 5 Extended
/dev/sdb5 501760 156366847 77932544 8e Linux LVM

Disk /dev/mapper/ubuntu-root: 77.7 GB, 77653344256 bytes
255 heads, 63 sectors/track, 9440 cylinders, total 151666688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu-root doesn’t contain a valid partition table

Disk /dev/mapper/ubuntu-swap_1: 2143 MB, 2143289344 bytes
255 heads, 63 sectors/track, 260 cylinders, total 4186112 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu-swap_1 doesn’t contain a valid partition table

라고 나옵니다.

root@ubuntu:~# dmsetup status
ubuntu-swap_1: 0 4186112 linear
ubuntu-root: 0 151666688 linear
root@ubuntu:~# dmsetup ls
ubuntu-swap_1 (252, 1)
ubuntu-root (252, 0)

도와주세요…
120기가짜리 하드를 포맷해서 /home2 로 마운트 하고 싶습니다…

mkfs가 실패하는 이유가 sda의 swap 파티션을 시스템에서 사용하고 있어서인 것 같습니다.
/etc/fstab 파일을 열어서 sda5를 swap으로 마운트하는 부분을 지우거나 주석처리하시고 재부팅해보세요.

혹시 해당 파티션의 UUID 정보가 필요하면 ls -l /dev/disk/by-uuid 명령어로 알 수 있습니다.

답변 감사합니다.
구글링 하다가 다른 방법도 찾았네요…

$ swapoff -v /dev/sda5 한 뒤에 수정도 했습니다…

root@ubuntu:~# mkfs.ext4 /dev/sda
이 명령은 오류입니다.
/dev/sda 는 파티션이 아니고 디스크 장치를 말하는 건데요.

파티션은 sda1, sda2 로 돼야 합니다.