Adding a hard drive after booting
DMESG | grep SD
SDA:SDA1 sda2
Sdb:unknown partition Table
Creating hard disk information
Fdisk/dev/sdb
Command (M forhelp): M
Command Action
A toggle a bootable flag
b Edit BSD Disklabel
C Toggle the DOS Compatibilityflag
D Delete a partition
L List known Partitiontypes
M Print this menu
n Add a new partition
o Create a new empty dospartition table
P Print the Partitiontable
Q Quit without savingchanges
s create a new empty Sundisklabel
t change a partition ' s SystemID
U Change display/entryunits
V Verify the Partitiontable
W Write table to disk Andexit
X extra Functionality (EXPERTSONLY)
Command (M for help): N Add partition
Command Action
E Extended
P primary partition (1-4)
P Add Primary partition
Partition number (1-4): 1
First cylinder (1-2610,default 1):
Using Default value 1
Last cylinder or +size or +sizem or +sizek (1-2610, default2610):
Using Default Value 2610
Command (M for help): W
Thepartition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
Format the hard drive
[Email protected] ~]# mkfs-t EXT3/DEV/SDB1
MKE2FS 1.39 (29-may-2006)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=0
Block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,2654208,
4096000
Writing Inode Tables:done
Creating Journal (32768 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem'll be automatically checked every mountsor
Whichever comes first. Use Tune2fs-cor-i to override.
Create mount Directory
Mkdir-p/mnt/centos01
Mout to the specified directory
Mount/dev/sdb1/mnt/centos01
Modify the/etc/fstab file to automatically load every boot
Vi/etc/fstab
/DEV/SDB1/MNT/CENTOS01 ext3 defaults 1 1
View
[[email protected] ~]# DF
filesystem 1k-blocks used Available use% mounted on
/dev/mapper/volgroup00-logvol00
18156292 2574216 14644912 15%/
/dev/sda1 101086 18382 77485 20%/boot
tmpfs 517552 0 517552 0%/DEV/SHM
/dev/sdb1 20635700 176200 19411264 1%/mnt/centos01
About removing hard drives, modifying/etc/fstab files, deleting related content
Remove the hard drive if you do not remove the/etc/fstab file
/DEV/SDB1/MNT/CENTOS01 ext3 defaults 1 1
will appear after reboot
Give Root password for maintenance
(or type control-d to continue):
Workaround:
This is all the file system is read-only, after entering the root password, use this command
#mount-O REMOUNT,RW/
Then remove the/etc/fstab file from the
/DEV/SDB1/MNT/CENTOS01 ext3 defaults 1 1
Reboot
Add a new hard disk or remove a hard disk under Linux