Editing
Solaris 10 System Administration Part I
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== ufs file system structures === ==== primary superblock ==== The primary superblock resides in the 16 disk sectors (sectors 16 to 31 relative to first sector on slice) that follow the space reserved for a SPARC boot block. superblock is a table of info that describes the file system which includes: * # of data blocks * # of cylinder groups * size of a data block & fragment * description of hardware, derived from the label * name of the mount point * file system state flag, flags are: ** clean ** stable ** active ** logging ** unknown ==== backup superblocks ==== when file system is created a backup copy of the superblock is created beginning at sector 32 & an additional backup is created at the beginning of each cylinder group. The replication protects the critical data in the superblock against catastrophic loss ==== cylinder groups ==== each file system is divided into cylinder groups with a minimum default size of 16 cylinders per group cylinder groups improve disk access & ufs constantly optimizes disk performance by moving file's data into a single cylinder group, large sized files > one cylinder are stored in multiple cylinders ==== cylinder group blocks ==== cylinder group block is a table in each cylinder group that describes the cylinder group, including: * # of inodes * # of data blocks in cylinder group * # of directories * free blocks, inodes, & fragments in cylinder group * free block map * used inode map <insert diagram that shows Solaris OS ufs structure> ==== usf inode ==== inode contains the following info about a file * type of file & access modes * user identification (UID) & group identification (GID) numbers of the file's owner & group * size of the file * link count * time the file was last accessed & modified & the inode changed * total # of data blocks used by or allocated to the file * two types of pointers: direct pointers & indirect pointers <insert visual depiction of inode> ==== direct pointers ==== inside inode there are 12 direct pointers, which contain addresses for the file's first 12 data blocks. the 12 direct pointers can each reference 8-Kbye data blocks for a file that is up to 96Kbytes ==== indirect pointers ==== [http://en.wikipedia.org/wiki/Inode_pointer_structure indirect pointer structure] 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''' <pre># 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</pre> '''Create ufs''' <pre># 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 #</pre> 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:''' <pre># 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 #</pre> repeat process for each partition and slice that needs a new file system ==== reserve free space ===== <pre># newfs -m 2 /dev/dsk/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</pre> ==== fstyp command ==== show minimum free size with fstyp & -v option <pre># fstyp -v /dev/dsk/c1t3d0s0 | grep minfree minfree 2% maxbpg 2048 optim time # fstyp -v /dev/rdsk/c1t3d0s0 | head ufs magic 11954 format dynamic time Wed Oct 5 15:57:18 2011 sblkno 16 cblkno 24 iblkno 32 dblkno 760 sbsize 2048 cgsize 8192 cgoffset 64 cgmask 0xffffffc0 ncg 214 size 10486368 blocks 10327132 bsize 8192 shift 13 mask 0xffffe000 fsize 1024 shift 10 mask 0xfffffc00 frag 8 shift 3 fsbtodb 1 minfree 2% maxbpg 2048 optim time maxcontig 128 rotdelay 0ms rps 167 #</pre> show minimum free size with fstyp & -v option <pre># fstyp -v /dev/rdsk/c1t3d0s0 | head ufs magic 11954 format dynamic time Wed Oct 5 15:57:18 2011 sblkno 16 cblkno 24 iblkno 32 dblkno 760 sbsize 2048 cgsize 8192 cgoffset 64 cgmask 0xffffffc0 ncg 214 size 10486368 blocks 10327132 bsize 8192 shift 13 mask 0xffffe000 fsize 1024 shift 10 mask 0xfffffc00 frag 8 shift 3 fsbtodb 1 minfree 2% maxbpg 2048 optim time maxcontig 128 rotdelay 0ms rps 167 #</pre> changing minimum free size <pre># tunefs -m 1 /dev/rdsk/c1t3d0s0 minimum percentage of free space changes from 2% to 1% # fstyp -v /dev/dsk/c1t3d0s0 | grep minfree minfree 1% maxbpg 2048 optim time #</pre>
Summary:
Please note that all contributions to GotOpinion may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
GotOpinion:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information