Unix United Professionals
Would you like to react to this message? Create an account in a few clicks or log in to continue.

fdisk - create a new partition and filesystem on local disk

Go down

fdisk - create a new partition and filesystem on local disk Empty fdisk - create a new partition and filesystem on local disk

Post by spanner Tue Apr 15, 2008 4:27 pm

E.G Create local partition/file system 5GB called /tools

Current Status

# fdisk -l

Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 12 96358+ 83 Linux ==> boot
/dev/cciss/c0d0p2 13 2101 16779892+ 83 Linux ==> /var
/dev/cciss/c0d0p3 2102 4190 16779892+ 82 Linux swap ==> swap
/dev/cciss/c0d0p4 4191 8920 37993725 5 Extended ==> Extended
/dev/cciss/c0d0p5 4191 5234 8385898+ 83 Linux ==> /mlextras
/dev/cciss/c0d0p6 5235 5756 4192933+ 83 Linux ==> /
/dev/cciss/c0d0p7 5757 5881 1004031 83 Linux ==> /itrs
/dev/cciss/c0d0p8 5882 6006 1004031 83 Linux ==> /mqmsw
/dev/cciss/c0d0p9 6007 7252 10008463+ 83 Linux ==> /mktdata

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p6 4.0G 1.5G 2.3G 40% /
tmpfs 4.0K 0 4.0K 0% /dev/vx
/dev/cciss/c0d0p1 92M 13M 74M 15% /boot
none 16G 0 16G 0% /dev/shm
/dev/cciss/c0d0p5 7.9G 251M 7.3G 4% /mlextras
/dev/cciss/c0d0p2 16G 464M 15G 4% /var
/dev/cciss/c0d0p7 966M 22M 895M 3% /itrs
/dev/cciss/c0d0p8 966M 230M 687M 26% /mqmsw
/dev/cciss/c0d0p9 9.4G 840M 8.1G 10% /mktdata



STEPS



# fdisk /dev/cciss/c0d0

n
+5g
w

# partprobe /dev/cciss/c0d0

CAREFUL : partprobe MAY CAUSE A REBOOT - Arrange downtime on live systems

# udevstart

# /sbin/mkfs -t ext3 /dev/cciss/c0d0p10

# e2label /dev/cciss/c0d0p10 /tools

Add to /etc/fstab

# mkdir /tools

# mount /tools





# fdisk /dev/cciss/c0d0

The number of cylinders for this disk is set to 8920.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

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): n
First cylinder (7253-8920, default 7253): ==> PRESS ENTER TO ACCEPT DEFAULT
Using default value 7253
Last cylinder or +size or +sizeM or +sizeK (7253-8920, default 8920): +5g

Command (m for help): p

Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 12 96358+ 83 Linux
/dev/cciss/c0d0p2 13 2101 16779892+ 83 Linux
/dev/cciss/c0d0p3 2102 4190 16779892+ 82 Linux swap
/dev/cciss/c0d0p4 4191 8920 37993725 5 Extended
/dev/cciss/c0d0p5 4191 5234 8385898+ 83 Linux
/dev/cciss/c0d0p6 5235 5756 4192933+ 83 Linux
/dev/cciss/c0d0p7 5757 5881 1004031 83 Linux
/dev/cciss/c0d0p8 5882 6006 1004031 83 Linux
/dev/cciss/c0d0p9 6007 7252 10008463+ 83 Linux
/dev/cciss/c0d0p10 7253 7861 4891761 83 Linux

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: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.



# partprobe /dev/cciss/c0d0



# udevstart



# cat /proc/partitions

major minor #blocks name

104 0 71652960 cciss/c0d0
104 1 96358 cciss/c0d0p1
104 2 16779892 cciss/c0d0p2
104 3 16779892 cciss/c0d0p3
104 5 8385898 cciss/c0d0p5
104 6 4192933 cciss/c0d0p6
104 7 1004031 cciss/c0d0p7
104 8 1004031 cciss/c0d0p8
104 9 10008463 cciss/c0d0p9
104 10 4891761 cciss/c0d0p10



# /sbin/mkfs -t ext3 /dev/cciss/c0d0p10
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
611648 inodes, 1222940 blocks
61147 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1254096896
38 block groups
32768 blocks per group, 32768 fragments per group
16096 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done

Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.



# e2label /dev/cciss/c0d0p10 /tools



# vi /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/mlextras /mlextras ext3 defaults 1 2
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/var /var ext3 defaults 1 2
LABEL=SW-cciss/c0d0p3 swap swap defaults 0 0
LABEL=/itrs /itrs ext3 defaults 1 2
LABEL=/mqmsw /mqmsw ext3 defaults 1 2
LABEL=/mktdata /mktdata ext3 defaults 1 2
LABEL=/tools /tools ext3 defaults 1 2
/dev/vx/dsk/dg_apps/apps /apps vxfs suid 1 2
/dev/hda /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0



# mkdir /tools



# mount /tools




# df -h /tools
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p10 4.6G 42M 4.4G 1% /tools



# mount -l | grep tools
/dev/cciss/c0d0p10 on /tools type ext3 (rw) [/tools]



spanner

Posts : 14
Join date : 2008-04-10
Location : Somewhere in Somerset - where there is a lot of mud - and sounds a bit "Horsey"

http://www.linkedin.com/in/sarbpanesar

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum