Solaris 10 System Administration Part I
indirect pointers
three types of indirect pointers are within an inode are:
- single indirect pointer - refers to a file system block that contains pointers to data blocks. this file system block contains 2048 additional addresses of 8-Kbyte data blocks, which can point to an additional 16 Mbytes of data
- double indirect pointer - refers to a file system block that contains single indirect pointers, each indirect pointer refers to a file system block that contains the data block pointers, double indirect pointers point to an additional 32 Gbytes of data
- triple indirect pointer - can reference up to an additional 64 Tbytes of data
data blocks
- remaining space allocated to ufs file system holds data blocks
- data blocks are allocated, by default, in 8-Kbyte logical block sizes
- blocks are further divided into 1-Kbyte fragments
- for a regular file, data blocks contains the contents of the file
- for a directory, data blocks contain entries that associate the inode numbers & the file names of the files & directories contained in that directory
- blocks not being used as files, directories, indirect address blocks, or storage blocks are marked as free in cylinder group map
- cylinder group map also keeps track of fragments to prevent disk performance degradation
fragmentation
fragmentation is a method to allocate disk space efficiently, files less than 96 Kbytes in size are stored using fragmentation
by default, data blocks can be divided into eight fragments of 1024 bytes each. fragments store files & pieces of files smaller than 8192 bytes. for files larger than 96 Kbytes, fragments are never allocated & full blocks are exclusively used
<insert graphic showing 1024 byte fragment in a data block of 8192 bytes>
if a file contained in a fragment grows & requires more space, it is allocated to one or more additional fragments in the same data block
<insert graphic showing two 3KB files in 1 8KB data block>
ufs does not allow fragments from same file to be stored in different data blocks
using new ufs command
- to use a disk to store directories & files a file system must be created on the partition the system wants to use
- as root user use newfs command to create ufs file system on a disk
- newfs command is a user friendly front end to the mkfs command, which is used to create file systems
- newfs command is in /usr/sbin directory
- existing data on a disk partition will be lost once ufs is created
Create partition
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424> /pci@1c,600000/scsi@2/sd@0,0 1. c1t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424> /pci@1c,600000/scsi@2/sd@1,0 2. c1t2d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424> /pci@1c,600000/scsi@2/sd@2,0 3. c1t3d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424> /pci@1c,600000/scsi@2/sd@3,0 Specify disk (enter its number): 3 selecting c1t3d0 [disk formatted] FORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze - surface analysis defect - defect list management backup - search for backup labels verify - read and display labels save - save new disk/partition definitions inquiry - show vendor, product and revision volname - set 8-character volume name !<cmd> - execute <cmd>, then return quit format> partition PARTITION MENU: 0 - change `0' partition 1 - change `1' partition 2 - change `2' partition 3 - change `3' partition 4 - change `4' partition 5 - change `5' partition 6 - change `6' partition 7 - change `7' partition select - select a predefined table modify - modify a predefined partition table name - name the current table print - display the current table label - write partition map and label to the disk !<cmd> - execute <cmd>, then return quit partition> modify Select partitioning base: 0. Current partition table (anon) 1. All Free Hog Choose base (enter number) [0]? 0 Part Tag Flag Cylinders Size Blocks 0 unassigned wm 0 - 2060 10.00GB (2061/0/0) 20972736 1 unassigned wm 2061 - 3091 5.00GB (1031/0/0) 10491456 2 backup wu 0 - 14086 68.35GB (14087/0/0) 143349312 3 - wu 3092 - 5152 10.00GB (2061/0/0) 20972736 4 - wu 5153 - 7213 10.00GB (2061/0/0) 20972736 5 unassigned wm 7214 - 9274 10.00GB (2061/0/0) 20972736 6 unassigned wm 9275 - 9964 3.35GB (690/0/0) 7021440 7 unassigned wm 9965 - 14086 20.00GB (4122/0/0) 41945472 Do you wish to continue creating a new partition table based on above table[yes]? yes Free Hog partition[6]? Enter size of partition '0' [20972736b, 2061c, 10240.59mb, 10.00gb]: 10gb Enter size of partition '1' [10491456b, 1031c, 5122.78mb, 5.00gb]: 5gb Enter size of partition '3' [20972736b, 2061c, 10240.59mb, 10.00gb]: 5gb Enter size of partition '4' [20972736b, 2061c, 10240.59mb, 10.00gb]: 5gb Enter size of partition '5' [20972736b, 2061c, 10240.59mb, 10.00gb]: 5gb Enter size of partition '7' [41945472b, 4122c, 20481.19mb, 20.00gb]: 5gb Part Tag Flag Cylinders Size Blocks 0 unassigned wm 0 - 2060 10.00GB (2061/0/0) 20972736 1 unassigned wm 2061 - 3091 5.00GB (1031/0/0) 10491456 2 backup wu 0 - 14086 68.35GB (14087/0/0) 143349312 3 - wu 3092 - 4122 5.00GB (1031/0/0) 10491456 4 - wu 4123 - 5153 5.00GB (1031/0/0) 10491456 5 unassigned wm 5154 - 6184 5.00GB (1031/0/0) 10491456 6 unassigned wm 6185 - 13055 33.34GB (6871/0/0) 69919296 7 unassigned wm 13056 - 14086 5.00GB (1031/0/0) 10491456 Okay to make this the current partition table[yes]? yes Enter table name (remember quotes): "anon" Ready to label disk, continue? y partition> quit FORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition table current - describe the current disk format - format and analyze the disk repair - repair a defective sector label - write label to the disk analyze - surface analysis defect - defect list management backup - search for backup labels verify - read and display labels save - save new disk/partition definitions inquiry - show vendor, product and revision volname - set 8-character volume name !<cmd> - execute <cmd>, then return quit format> save Saving new disk and partition definitions Enter file name["./format.dat"]: ./format-c1t30s0.dat format> quit
Create ufs
# newfs /dev/rdsk/c1t3d0s0 newfs: construct a new file system /dev/rdsk/c1t3d0s0: (y/n)? y Warning: 2880 sector(s) in last cylinder unallocated /dev/rdsk/c1t3d0s0: 20972736 sectors in 3414 cylinders of 48 tracks, 128 sectors 10240.6MB in 214 cyl groups (16 c/g, 48.00MB/g, 5824 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920, 20055584, 20154016, 20252448, 20350880, 20449312, 20547744, 20646176, 20744608, 20843040, 20941472 #
ufs command outputs basic disk geometry & ufs created on slice 0 (c1t3d0s0), the beginning sector locations of backup superblocks also displayed
nfs -i command is used to specify density of the number of bytes per inode in file system
Determine number of bytes per inode (nbpi) with mkfs -m command:
# mkfs -m /dev/rdsk/c1t3d0s0 mkfs -F ufs -o nsect=128,ntrack=48,bsize=8192,fragsize=1024,cgsize=16,free=1,rps=167,nbpi=8155,opt=t,apc=0,gap=0,nrpos=8,maxcontig=128,mtb=n /dev/rdsk/c1t3d0s0 20972736 #
repeat process for each partition and slice that needs a new file system