본문 바로가기
Linux

15일 자동마운트

by 삼성그룹이장 2014. 6. 25.

http://twoseven.kr/mount.txt



[root /dev]$ ls sd*
sda  sda1  sda2  sdb  sdc  sdd  sde  sdf  sdg
[root /dev]$ 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.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512): +100M

Command (m for help): p

Disk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          96       98288   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root /dev]$ ls
MAKEDEV          hdb                 ram15       tty14  tty57
VolGroup00       hdc                 ram2        tty15  tty58
X0R              hidraw0             ram3        tty16  tty59
adsp             hidraw1             ram4        tty17  tty6
agpgart          hpet                ram5        tty18  tty60
audio            initctl             ram6        tty19  tty61
autofs           input               ram7        tty2   tty62
bus              js0                 ram8        tty20  tty63
cdrom            kmsg                ram9        tty21  tty7
cdrom-hdc        log                 ramdisk     tty22  tty8
cdrw             loop0               random      tty23  tty9
cdrw-hdc         loop1               rawctl      tty24  ttyS0
cdwriter         loop2               root        tty25  ttyS1
cdwriter-hdc     loop3               rtc         tty26  ttyS2
console          loop4               sda         tty27  ttyS3
core             loop5               sda1        tty28  urandom
cpu_dma_latency  loop6               sda2        tty29  usbdev1.1_ep81
disk             loop7               sdb         tty3   usbdev2.1_ep00
dmmidi           lp0                 sdb1        tty30  usbdev2.1_ep81
dsp              mapper              sdc         tty31  usbdev2.2_ep00
dvd              md0                 sdd         tty32  usbdev2.2_ep81
dvd-hdc          mem                 sde         tty33  usbdev2.2_ep82
dvdrw            midi                sdf         tty34  usbdev2.3_ep00
dvdrw-hdc        mixer               sdg         tty35  usbdev2.3_ep81
dvdwriter        net                 sequencer   tty36  vcs
dvdwriter-hdc    network_latency     sequencer2  tty37  vcs2
fd               network_throughput  sg0         tty38  vcs3
fd0              null                sg1         tty39  vcs4
fd0u1040         nvram               sg2         tty4   vcs5
fd0u1120         oldmem              sg3         tty40  vcs6
fd0u1440         par0                sg4         tty41  vcs7
fd0u1680         parport0            sg5         tty42  vcs8
fd0u1722         parport1            sg6         tty43  vcsa
fd0u1743         parport2            shm         tty44  vcsa2
fd0u1760         parport3            snapshot    tty45  vcsa3
fd0u1840         port                snd         tty46  vcsa4
fd0u1920         ppp                 stderr      tty47  vcsa5
fd0u360          ptmx                stdin       tty48  vcsa6
fd0u720          pts                 stdout      tty49  vcsa7
fd0u800          ram                 systty      tty5   vcsa8
fd0u820          ram0                tty         tty50  vmci
fd0u830          ram1                tty0        tty51  vsock
floppy           ram10               tty1        tty52  zero
floppy-fd0       ram11               tty10       tty53
full             ram12               tty11       tty54
gpmctl           ram13               tty12       tty55
hda              ram14               tty13       tty56
[root /dev]$ ls sd*
sda  sda1  sda2  sdb  sdb1  sdc  sdd  sde  sdf  sdg
[root /dev]$ mount /dev/sdb1 /mailhome
mount: you must specify the filesystem type
[root /dev]$ mount /dev/sdb1 /mailhome
mount: you must specify the filesystem type
[root /dev]$ useradd -d /mailhome/muser1 muser1
[root /dev]$ useradd -d /mailhome/muser2 muser2
[root /dev]$ useradd -d /mailhome/muser3 muser3
[root /dev]$ ls /mailhome/
muser1  muser2  muser3

===========================

2번 장치 설정

[user1@centos2 ~]$ vi .bashrc

PS1="\h[\u \$PWD]$ "
export PS1
lias df='df -h'


[user1@centos2 ~]$ source .bashrc


root 도 같이 설정


centos2[root /etc]# vi hosts
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]# hostname
centos2
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]# cd /dev
centos2[root /dev]# ls sd* hd*
hda  hdb  hdc  sda  sda1  sda2  sdb  sdb1  sdc  sdd  sde  sdf  sdg
centos2[root /dev]# fdisk /dev/sdc

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)

centos2[root /dev]# df
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.7G  8.7G  30% /
/dev/sdb1             494M   11M  458M   3% /home
tmpfs                 394M     0  394M   0% /dev/shm
centos2[root /dev]# fdisk /dev/sdc

Command (m for help): p

Disk /dev/sdc: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   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-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512): +100M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (97-512, default 97):
Using default value 97
Last cylinder or +size or +sizeM or +sizeK (97-512, default 512): +100M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (193-512, default 193):
Using default value 193
Last cylinder or +size or +sizeM or +sizeK (193-512, default 512): +100M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First cylinder (289-512, default 289):
Using default value 289
Last cylinder or +size or +sizeM or +sizeK (289-512, default 512): 512

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
centos2[root /dev]# mkfs.ext3 sdc1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24576 inodes, 98288 blocks
4914 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2048 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 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
centos2[root /dev]# mkfs.ext3 sdc2
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24576 inodes, 98304 blocks
4915 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2048 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 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
centos2[root /dev]# mkfs.ext3 sdc3
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24576 inodes, 98304 blocks
4915 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2048 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 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
centos2[root /dev]# mkfs.ext3 sdc4
mke2fs 1.39 (29-May-2006)
sdc4: Invalid argument passed to ext2 library while setting up superblock
centos2[root /dev]#
centos2[root /dev]#
centos2[root /dev]# cd /
centos2[root /]# mkdir /mailhome
centos2[root /]# mount /dev/sdc1 /mailhome
centos2[root /]# useradd muser1
centos2[root /]# useradd muser2
centos2[root /]# useradd muser3
centos2[root /]# userdel -r muser1
centos2[root /]# userdel -r muser2
centos2[root /]# userdel -r muser3
centos2[root /]# df /mailhome
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdc1              93M  5.6M   83M   7% /mailhome
centos2[root /]# useradd -d /mailhome/muser1 muser1
centos2[root /]# useradd -d /mailhome/muser2 muser2
centos2[root /]# useradd -d /mailhome/muser3 muser3
centos2[root /]# df
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.8G  8.7G  31% /
/dev/sdb1             494M   11M  458M   3% /home
tmpfs                 394M     0  394M   0% /dev/shm
/dev/sdc1              93M  5.6M   83M   7% /mailhome
centos2[root /]# grep LABEL /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=SWAP-sda2         swap                    swap    defaults        0 0
centos2[root /]# e2label
Usage: e2label device [newlabel]
centos2[root /]# /dev/sdb1
-bash: /dev/sdb1: 허가 거부됨
centos2[root /]# /dev/sdb1/home
-bash: /dev/sdb1/home: 디렉토리가 아닙니다
centos2[root /]# e2label /dev/sdb1/home
e2label: 디렉토리가 아닙니다 while trying to open /dev/sdb1/home
Couldn't find valid filesystem superblock.
centos2[root /]# e2label /dev/sdb1
/home
centos2[root /]# e2label /dev/sdc1

centos2[root /]# e2label /dev/sdc1

centos2[root /]# e2label /dev/sdc1 /mailhome
centos2[root /]# e2label /dev/sdc1
/mailhome
centos2[root /]# cd /etc/fstab
-bash: cd: /etc/fstab: 디렉토리가 아닙니다
centos2[root /]# cd /etc/
centos2[root /etc]# vi fstab
centos2[root /etc]# tail -1 fstab
LABEL=/mailhome /mailhome ext3 defaults 1 2
centos2[root /etc]# umount /dev/sdc1
centos2[root /etc]# mount -a
centos2[root /etc]# df | grep mailhome
/dev/sdc1              93M  5.6M   83M   7% /mailhome
centos2[root /etc]# ls /mailhome/
lost+found  muser1  muser2  muser3
centos2[root /etc]# mount -a
centos2[root /etc]# ls /mailhome/
lost+found  muser1  muser2  muser3
centos2[root /etc]# mount -a
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]# clear


entos2[root /root]# dumpe2fs /dev/sdc2

uuid로 하기


centos2[root /etc]# tail -1 /etc/fstab
LABEL=/mailhome /mailhome ext3 defaults 1 2
centos2[root /etc]# cd /etc
centos2[root /etc]# cat fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/home             /home                   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-sda2         swap                    swap    defaults        0 0
LABEL=/mailhome /mailhome ext3 defaults 1 2
centos2[root /etc]# vi fstab
centos2[root /etc]# umount -a
umount: /var/lib/nfs/rpc_pipefs: device is busy
umount: /: device is busy
centos2[root /etc]# umount -a
umount: /var/lib/nfs/rpc_pipefs: device is busy
umount: /: device is busy
centos2[root /etc]# mount -a
mount: mount point /mnt/d3p1 does not exist
centos2[root /etc]# mkdir /mnt/d3p1
centos2[root /etc]# mount -a
centos2[root /etc]# dumpe2fs /dev/sdc2
dumpe2fs 1.39 (29-May-2006)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          1826b590-f1e9-4393-a012-c353849c52fb
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype needs_reco                                                                                                                     very sparse_super
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              24576
Block count:              98304
Reserved block count:     4915
Free blocks:              89531
Free inodes:              24565
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2048
Inode blocks per group:   256
Filesystem created:       Thu Jun 26 05:22:14 2014
Last mount time:          Thu Jun 26 05:53:29 2014
Last write time:          Thu Jun 26 05:53:29 2014
Mount count:              1
Maximum mount count:      32
Last checked:             Thu Jun 26 05:22:14 2014
Check interval:           15552000 (6 months)
Next check after:         Tue Dec 23 05:22:14 2014
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      20c2b6ca-d696-44d4-924e-3c25281dcd62
Journal backup:           inode blocks
Journal size:             4114k


Group 0: (Blocks 1-8192)
  Primary superblock at 1, Group descriptors at 2-2
  Reserved GDT blocks at 3-258
  Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
  Inode table at 261-516 (+260)
  3548 free blocks, 2037 free inodes, 2 directories
  Free blocks: 4645-8192
  Free inodes: 12-2048
Group 1: (Blocks 8193-16384)
  Backup superblock at 8193, Group descriptors at 8194-8194
  Reserved GDT blocks at 8195-8450
  Block bitmap at 8451 (+258), Inode bitmap at 8452 (+259)
  Inode table at 8453-8708 (+260)
  7676 free blocks, 2048 free inodes, 0 directories
  Free blocks: 8709-16384
  Free inodes: 2049-4096
Group 2: (Blocks 16385-24576)
  Block bitmap at 16385 (+0), Inode bitmap at 16386 (+1)
  Inode table at 16387-16642 (+2)
  7934 free blocks, 2048 free inodes, 0 directories
  Free blocks: 16643-24576
  Free inodes: 4097-6144
Group 3: (Blocks 24577-32768)
  Backup superblock at 24577, Group descriptors at 24578-24578
  Reserved GDT blocks at 24579-24834
  Block bitmap at 24835 (+258), Inode bitmap at 24836 (+259)
  Inode table at 24837-25092 (+260)
  7676 free blocks, 2048 free inodes, 0 directories
  Free blocks: 25093-32768
  Free inodes: 6145-8192
Group 4: (Blocks 32769-40960)
  Block bitmap at 32769 (+0), Inode bitmap at 32770 (+1)
  Inode table at 32771-33026 (+2)
  7934 free blocks, 2048 free inodes, 0 directories
  Free blocks: 33027-40960
  Free inodes: 8193-10240
Group 5: (Blocks 40961-49152)
  Backup superblock at 40961, Group descriptors at 40962-40962
  Reserved GDT blocks at 40963-41218
  Block bitmap at 41219 (+258), Inode bitmap at 41220 (+259)
  Inode table at 41221-41476 (+260)
  7676 free blocks, 2048 free inodes, 0 directories
  Free blocks: 41477-49152
  Free inodes: 10241-12288
Group 6: (Blocks 49153-57344)
  Block bitmap at 49153 (+0), Inode bitmap at 49154 (+1)
  Inode table at 49155-49410 (+2)
  7934 free blocks, 2048 free inodes, 0 directories
  Free blocks: 49411-57344
  Free inodes: 12289-14336
Group 7: (Blocks 57345-65536)
  Backup superblock at 57345, Group descriptors at 57346-57346
  Reserved GDT blocks at 57347-57602
  Block bitmap at 57603 (+258), Inode bitmap at 57604 (+259)
  Inode table at 57605-57860 (+260)
  7676 free blocks, 2048 free inodes, 0 directories
  Free blocks: 57861-65536
  Free inodes: 14337-16384
Group 8: (Blocks 65537-73728)
  Block bitmap at 65537 (+0), Inode bitmap at 65538 (+1)
  Inode table at 65539-65794 (+2)
  7934 free blocks, 2048 free inodes, 0 directories
  Free blocks: 65795-73728
  Free inodes: 16385-18432
Group 9: (Blocks 73729-81920)
  Backup superblock at 73729, Group descriptors at 73730-73730
  Reserved GDT blocks at 73731-73986
  Block bitmap at 73987 (+258), Inode bitmap at 73988 (+259)
  Inode table at 73989-74244 (+260)
  7676 free blocks, 2048 free inodes, 0 directories
  Free blocks: 74245-81920
  Free inodes: 18433-20480
Group 10: (Blocks 81921-90112)
  Block bitmap at 81921 (+0), Inode bitmap at 81922 (+1)
  Inode table at 81923-82178 (+2)
  7934 free blocks, 2048 free inodes, 0 directories
  Free blocks: 82179-90112
  Free inodes: 20481-22528
Group 11: (Blocks 90113-98303)
  Block bitmap at 90113 (+0), Inode bitmap at 90114 (+1)
  Inode table at 90115-90370 (+2)
  7933 free blocks, 2048 free inodes, 0 directories
  Free blocks: 90371-98303
  Free inodes: 22529-24576
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]#
centos2[root /etc]# cat /etc/mtab
/dev/sda1 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/dev/sdb1 /home ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/sdc1 /mailhome ext3 rw 0 0
/dev/sdc2 /mnt/d3p1 ext3 rw,nosuid 0 0
centos2[root /etc]# vi fstab
centos2[root /etc]# tail -1 fstab
/dev/sdc3 /mnt/d3p3 ext3 ro,nosuid,noexec,noauto 1 2
centos2[root /etc]# mkdir /mnt/d3p3
centos2[root /etc]# mount -a
centos2[root /etc]# df | tail -1
/dev/sdc2              93M  5.6M   83M   7% /mnt/d3p1
centos2[root /etc]# df /mnt/d3p3
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.8G  8.7G  31% /
centos2[root /etc]# tail -3 fstab
LABEL=/mailhome /mailhome ext3 defaults 1 2
UUID=1826b590-f1e9-4393-a012-c353849c52fb /mnt/d3p1 ext3 rw,nosuid 1 2
/dev/sdc3 /mnt/d3p3 ext3 ro,nosuid,noexec,noauto 1 2
centos2[root /etc]#
centos2[root /etc]# mount -a (오토로 된것만 마운트 해라)
centos2[root /etc]# umount -a (모두 하는게 맞다.)
centos2[root /etc]# mount --help
Usage: mount -V                 : print version
       mount -h                 : print this help
       mount                    : list mounted filesystems
       mount -l                 : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
       mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
       mount device             : mount device at the known place
       mount directory          : mount known device here
       mount -t type dev dir    : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
       mount --bind olddir newdir
or move a subtree:
       mount --move olddir newdir
One can change the type of mount containing the directory dir:
       mount --make-shared dir
       mount --make-slave dir
       mount --make-private dir
       mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
       mount --make-rshared dir
       mount --make-rslave dir
       mount --make-rprivate dir
       mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using  -L label  or by uuid, using  -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say  man 8 mount .
centos2[root /etc]# mount /dev/sdc3
centos2[root /etc]# df | tail -1
/dev/sdc3              93M  5.6M   83M   7% /mnt/d3p3
centos2[root /etc]# mount | tail -1
/dev/sdc3 on /mnt/d3p3 type ext3 (ro,noexec,nosuid)
centos2[root /etc]#
centos2[root /etc]# umount /dev/sdc3
centos2[root /etc]# mount /mnt/d3p3
centos2[root /etc]# tail -1 fstab
/dev/sdc3 /mnt/d3p3 ext3 ro,nosuid,noexec,noauto 1 2
centos2[root /etc]# tail -2 fstab
UUID=1826b590-f1e9-4393-a012-c353849c52fb /mnt/d3p1 ext3 rw,nosuid 1 2
/dev/sdc3 /mnt/d3p3 ext3 ro,nosuid,noexec,noauto 1 2
centos2[root /etc]# mkfs -t ext3 /dev/sdc2
mke2fs 1.39 (29-May-2006)
/dev/sdc2 is mounted; will not make a filesystem here!
centos2[root /etc]# umount /dev/sdc3
centos2[root /etc]# mkfs -t ext3 /dev/sdc3
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24576 inodes, 98304 blocks
4915 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2048 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 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
centos2[root /etc]# mount -a
centos2[root /etc]# dump2fs /dev/sdc2 | grep -i uuid
-bash: dump2fs: command not found
centos2[root /etc]# dump2fs /dev/sdc3 | grep -i uuid
-bash: dump2fs: command not found
centos2[root /etc]# dump2fs /dev/sdc3 | grep -i uuid
-bash: dump2fs: command not found
centos2[root /etc]# df -a
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.8G  8.7G  31% /
proc                     0     0     0   -  /proc
sysfs                    0     0     0   -  /sys
devpts                   0     0     0   -  /dev/pts
sunrpc                   0     0     0   -  /var/lib/nfs/rpc_pipefs
/dev/sdb1             494M   11M  458M   3% /home
tmpfs                 394M     0  394M   0% /dev/shm
/dev/sdc1              93M  5.6M   83M   7% /mailhome
/dev/sdc2              93M  5.6M   83M   7% /mnt/d3p1
centos2[root /etc]# cat fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/home             /home                   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-sda2         swap                    swap    defaults        0 0
LABEL=/mailhome /mailhome ext3 defaults 1 2
UUID=1826b590-f1e9-4393-a012-c353849c52fb /mnt/d3p1 ext3 rw,nosuid 1 2
/dev/sdc3 /mnt/d3p3 ext3 ro,nosuid,noexec,noauto 1 2
centos2[root /etc]# c



centos2[root /var/log]# cd /var/log
centos2[root /var/log]# last
root     pts/1        192.168.10.1     Thu Jun 26 05:46   still logged in
root     pts/2        192.168.10.1     Thu Jun 26 05:05   still logged in
root     pts/1        :0.0             Thu Jun 26 05:03 - 05:16  (00:13)
root     :0                            Thu Jun 26 05:03   still logged in
root     :0                            Thu Jun 26 05:03 - 05:03  (00:00)
reboot   system boot  2.6.18-348.el5   Thu Jun 26 04:56          (01:12)
reboot   system boot  2.6.18-348.el5   Thu Jun 26 04:51          (00:03)

wtmp begins Thu Jun 26 04:51:26 2014
centos2[root /var/log]# cat secure (원격 접속등 보인다.
-bash: syntax error near unexpected token `('
centos2[root /var/log]# fdisk

Usage: fdisk [-l] [-b SSZ] [-u] device
E.g.: fdisk /dev/hda  (for the first IDE disk)
  or: fdisk /dev/sdc  (for the third SCSI disk)
  or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
  or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
  ...
centos2[root /var/log]# df
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.8G  8.6G  31% /
/dev/sdb1             494M   11M  458M   3% /home
tmpfs                 394M     0  394M   0% /dev/shm
/dev/sdc1              93M  5.6M   83M   7% /mailhome
/dev/sdc2              93M  5.6M   83M   7% /mnt/d3p1
centos2[root /var/log]# fdisk /dev/sdc3
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.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdc3: 100 MB, 100663296 bytes
64 heads, 32 sectors/track, 96 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

     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): 4
First cylinder (1-96, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-96, default 96):
Using default value 96

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: 부적절한 인수.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
centos2[root /var/log]# df
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.8G  8.6G  31% /
/dev/sdb1             494M   11M  458M   3% /home
tmpfs                 394M     0  394M   0% /dev/shm
/dev/sdc1              93M  5.6M   83M   7% /mailhome
/dev/sdc2              93M  5.6M   83M   7% /mnt/d3p1
centos2[root /var/log]# fdisk /sdc

Unable to open /sdc
centos2[root /var/log]# fdisk /dev/sdc

Command (m for help): p

Disk /dev/sdc: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          96       98288   83  Linux
/dev/sdc2              97         192       98304   83  Linux
/dev/sdc3             193         288       98304   83  Linux
/dev/sdc4             289         512      229376    5  Extended

Command (m for help): d
Partition number (1-5): 4

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Selected partition 1

Command (m for help): 1
1: unknown command
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/sdc: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 장치나 자원이 동작 중.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
^[[centos2[root /var/log]# mkfs -t ext3 /dev/sdc1
mke2fs 1.39 (29-May-2006)
/dev/sdc1 is mounted; will not make a filesystem here!
centos2[root /var/log]# fdisk /dev/sdc

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Using default value 512

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 장치나 자원이 동작 중.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
centos2[root /var/log]# mkfs -t ext3 /dev/sdc1
mke2fs 1.39 (29-May-2006)
/dev/sdc1 is mounted; will not make a filesystem here!
centos2[root /var/log]# mkfs -t ext3 /dev/sdc
mke2fs 1.39 (29-May-2006)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/sdc is apparently in use by the system; will not make a filesystem here!
centos2[root /var/log]# mount /dev/sdc1 /mnt/d3p1
centos2[root /var/log]# cp -rp /var/log/*
cp: target `/var/log/yum.log' is not a directory
centos2[root /var/log]# cp -rp /var/log/*
cp: target `/var/log/yum.log' is not a directory
centos2[root /var/log]# mount /dev/sdc /mnt/d3p1
mount: /dev/sdc already mounted or /mnt/d3p1 busy
mount: according to mtab, /dev/sdc2 is already mounted on /mnt/d3p1
centos2[root /var/log]# cp -rp /var/log/*
cp: target `/var/log/yum.log' is not a directory
centos2[root /var/log]# mount /dev/sdc /mnt/d3p1
mount: /dev/sdc already mounted or /mnt/d3p1 busy
mount: according to mtab, /dev/sdc2 is already mounted on /mnt/d3p1
centos2[root /var/log]#
centos2[root /var/log]#
centos2[root /var/log]#
centos2[root /var/log]# df
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              14G  3.8G  8.6G  31% /
/dev/sdb1             494M   11M  458M   3% /home
tmpfs                 394M     0  394M   0% /dev/shm
/dev/sdc1              93M  5.6M   83M   7% /mailhome
/dev/sdc2              93M  5.6M   83M   7% /mnt/d3p1
/dev/sdc1              93M  5.6M   83M   7% /mnt/d3p1
centos2[root /var/log]# cp -rp /var/log/* /mnt/d3p1
centos2[root /var/log]# rm -rf /var/log/*
centos2[root /var/log]# cd /etc
centos2[root /etc]# vi fstab
centos2[root /etc]# ls /var/log
centos2[root /etc]# umount -a
umount: /var/lib/nfs/rpc_pipefs: device is busy
umount: /: device is busy
centos2[root /etc]# mount -a
mount: mount point /varlog does not exist
centos2[root /etc]# ls /var/log
centos2[root /etc]# pgrep syslogd
3227
centos2[root /etc]# pgrep syslogd -fl
3227 syslogd -m 0
centos2[root /etc]# service syslog restart
커널관련 기록을 종료 중:                                   [  OK  ]
시스템 기록을 종료 중:                                     [  OK  ]
시스템 기록을 시작 중:                                     [  OK  ]
커널관련 기록을 시작:                                      [  OK  ]

centos2[root /etc]#









반응형

'Linux' 카테고리의 다른 글

18일 레이드 구성  (0) 2014.06.30
17일차 ext2 ext3 차이, 파일세스템 및 복구  (0) 2014.06.27
14일 마운트 공부  (0) 2014.06.24
13일 차 리눅스 파일시스템 및 마운트  (0) 2014.06.23
12일차 cron 명령어.  (0) 2014.06.20