# linux 6 버전에서 새로운 디스크 추가 후 fdisk 로 포맷 및 마운트 작업 #

 

[root@localhost /]# fdisk /dev/sd

 

 

sda   sda1
sda2  sda3  sdb
sdb1 

 

 

[root@localhost /]# 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 0x34c1337c.

 

 

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)

 

 

 

 

 

The device presents
a logical sector size that is smaller than

 

 

the physical sector
size. Aligning to a physical sector (or optimal

 

 

I/O) size boundary
is recommended, or performance may be impacted.

 

 

 

 

 

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):
m

 

 

Command action

 

 

   a
toggle a bootable flag

 

 

   b
edit bsd disklabel

 

 

   c
toggle the dos compatibility flag

 

 

   d
delete a partition

 

 

   l
list known partition types

 

 

   m
print this menu

 

 

   n
add a new partition

 

 

   o
create a new empty DOS partition table

 

 

   p
print the partition table

 

 

   q
quit without saving changes

 

 

   s
create a new empty Sun disklabel

 

 

   t
change a partition’s system id

 

 

   u
change display/entry units

 

 

   v
verify the partition table

 

 

   w
write table to disk and exit

 

 

   x
extra functionality (experts only)

 

 

 

 

 

Command (m for
help):
p

 

 

 

 

 

Disk /dev/sdb: 136.4
GB, 136365211648 bytes

 

 

255 heads, 63
sectors/track, 16578 cylinders

 

 

Units = cylinders of
16065 * 512 = 8225280 bytes

 

 

Sector size
(logical/physical): 512 bytes / 4096 bytes

 

 

I/O size
(minimum/optimal): 4096 bytes / 4096 bytes

 

 

Disk identifier:
0x34c1337c

 

 

 

 

 

   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-16578, default 1):
16578

 

 

 

 

 

Command (m for
help):
p

 

 

 

 

 

Disk /dev/sdb: 136.4
GB, 136365211648 bytes

 

 

255 heads, 63
sectors/track, 16578 cylinders

 

 

Units = cylinders of
16065 * 512 = 8225280 bytes

 

 

Sector size
(logical/physical): 512 bytes / 4096 bytes

 

 

I/O size
(minimum/optimal): 4096 bytes / 4096 bytes

 

 

Disk identifier:
0x34c1337c

 

 

 

 

 

   Device Boot      Start         End      Blocks
Id  System

 

 

/dev/sdb1           16578       16578        8032+
83  Linux

 

 

Partition 1 does not
start on physical sector boundary.

 

 

 

 

 

Command (m for
help):
w

 

 

The partition table
has been altered!

 

 

 

 

 

Calling ioctl() to
re-read partition table.

 

 

Syncing disks.

 

 

[root@localhost /]#
mkfs.ext4 /dev/sdb

 

 

sdb   sdb1 

 

 

[root@localhost /]#
mkfs.ext4 /dev/sdb

 

 

sdb   sdb1 

 

 

[root@localhost /]#
mkfs.ext4 /dev/sdb

 

 

sdb   sdb1 

 

 

[root@localhost /]#
fdisk -l

 

 

 

 

 

Disk /dev/sda: 136.4
GB, 136365211648 bytes

 

 

255 heads, 63
sectors/track, 16578 cylinders

 

 

Units = cylinders of
16065 * 512 = 8225280 bytes

 

 

Sector size
(logical/physical): 512 bytes / 4096 bytes

 

 

I/O size
(minimum/optimal): 4096 bytes / 4096 bytes

 

 

Disk identifier:
0x0008482b

 

 

 

 

 

   Device Boot      Start         End      Blocks
Id  System

 

 

/dev/sda1   *
1          26      204800
83  Linux

 

 

Partition 1 does not
end on cylinder boundary.

 

 

/dev/sda2              26       16057
128769024   83  Linux

 

 

/dev/sda3           16057       16579
4194304   82  Linux swap / Solaris

 

 

 

 

 

Disk
/dev/sdb: 136.4 GB, 136365211648 bytes

 

 

255 heads,
63 sectors/track, 16578 cylinders

 

 

Units =
cylinders of 16065 * 512 = 8225280 bytes

 

 

Sector
size (logical/physical): 512 bytes / 4096 bytes

 

 

I/O size
(minimum/optimal): 4096 bytes / 4096 bytes

 

 

Disk
identifier: 0x34c1337c

 

 

 

 

 

   Device Boot      Start         End      Blocks
Id  System

 

 

/dev/sdb1           16578       16578        8032+
83  Linux

 

 

Partition
1 does not start on physical sector boundary.

 

 

 

 

 

[root@localhost /]# mkfs.ext4 /dev/sdb1

 

 

mke2fs 1.41.12
(17-May-2010)

 

 

/dev/sdb1 alignment
is offset by 3584 bytes.

 

 

This may result in
very poor performance, (re)-partitioning suggested.

 

 

Discarding device
blocks: done
                           

 

 

Filesystem label=

 

 

OS type: Linux

 

 

Block size=1024
(log=0)

 

 

Fragment size=1024
(log=0)

 

 

Stride=4 blocks,
Stripe width=0 blocks

 

 

2008 inodes, 8032
blocks

 

 

401 blocks (4.99%)
reserved for the super user

 

 

First data block=1

 

 

Maximum filesystem
blocks=8388608

 

 

1 block group

 

 

8192 blocks per
group, 8192 fragments per group

 

 

2008 inodes per
group

 

 

 

 

 

Writing inode
tables: done
                           

 

 

Creating journal
(1024 blocks): done

 

 

Writing superblocks
and filesystem accounting information: done

 

 

 

 

 

This filesystem will
be automatically checked every 35 mounts or

 

 

180 days, whichever
comes first.
  Use tune2fs -c or -i to
override.

[root@localhost /]# tune2fs -c -1 -i 0 /dev/sdb1   (파일시스템 강제 체크하는 마운트 횟수 및 기간 설정 변경)

 

tune2fs
1.41.12 (17-May-2010)

Setting
maximal mount count to -1

 

Setting
interval between checks to 0 seconds

 

[root@localhost /]# mkdir -p /data2

 

 

[root@localhost /]# blkid (sdb1의 유니크한 ID(UUID) 확인)

 

 

/dev/sda3:
UUID=”b5755e1d-8cc8-471d-a5a4-a21cfe24afde” TYPE=”ext4″

 

 

/dev/sdb1:
UUID=”2d3e8015-0704-48f1-9bd6-6124a17c3a53″ TYPE=”ext4″

 

 

/dev/sda1:
UUID=”000f715a-e4af-4a0a-9371-0f2fb51550ef” TYPE=”ext4″

 

 

/dev/sda2:
UUID=”54f61ddb-9bb6-47a8-a3e9-4839c9ac1300″ TYPE=”swap”

 

 

/dev/sdb1:
UUID=”5acda3c5-830a-4141-b274-377b9542a73f” TYPE=”ext4″

[root@localhost /]# vi /etc/fstab (fstab에 마운트 추가)

 


9 UUID=b5755e1d-8cc8-471d-a5a4-a21cfe24afde
/
ext4    defaults        1 1

10
UUID=000f715a-e4af-4a0a-9371-0f2fb51550ef
/boot
ext4    defaults        1 2

11
UUID=2d3e8015-0704-48f1-9bd6-6124a17c3a53
/data
ext4    defaults        1 2

12
UUID=54f61ddb-9bb6-47a8-a3e9-4839c9ac1300
swap
swap    defaults        0 0

13 UUID=5acda3c5-830a-4141-b274-377b9542a73f
/data2
ext4    defaults        0 0 (
추가)

14
tmpfs
/dev/shm
tmpfs   defaults        0 0

15
devpts
/dev/pts
devpts  gid=5,mode=620  0 0

16
sysfs
/sys
sysfs   defaults        0 0

 

 

 

 

 

 

 

 

 

 

17
proc
/proc
proc    defaults        0 0

 

 

[root@dsmaref ~]# mount -a (자동마운트로 붙는지 확인)

 

 

[root@dsmaref
~]#
df -h

 

 

Filesystem
Size  Used Avail Use% Mounted on

 

 

/dev/sda3
212G   51G  151G  26% /

 

 

tmpfs
16G   80K   16G   1% /dev/shm

 

 

/dev/sda1
190M   38M  142M  22% /boot

 

 

/dev/sdb1
11T  2.2T  8.1T  21% /data

 

 

/dev/sdb1
3.6T   68M  3.4T   1% /data2

 

Leave a Comment