Partition Sizes

Good Morning,

What's a good way to get partition/slice sizes down to the byte on Solaris 9? I've tried a few ways, but only see results like 8.21GB which rounds the number.

Thanks!

on what OS? I doubt you get anything close to the byte as the smallest disk block would be 512...

1 Like

Please explain.

Why would you possibly want to size a partition with byte accuracy? Are you short on disk space or something??

Anyway, normally, the disk sector is the smallest unit of currency so that's 512 bytes. Also, many OS's operate to the nearest disk cylinder.

Usually, if a filesystem fills up you are stuffed and need to expand it. Depending on what disk/filesystem you are running that could prove labor intensive unless you are running a OS that allows you to expand a filesystem easily. You normally need to leave good headroom to ensure the filesystem doesn't fill.

1 Like

Seconding what the two colleagues said, parted allows for byte size display:
man parted :

Not sure if your system provides that tool; you didn't mention it. Don't let yourself be tricked into thinking that byte info were more meaningful than the "sector" or other info as 512 (or 4096 on newer systems / disks) byte blocks are the smallest allocation units.

1 Like

It has to do with my cloning efforts with

ufsrestore

and disk mirroring. I believe when creating a mirror, the slices have to be precise and I'm about to format a drive for it.

Ah, well, I understand. I've been helping you with the cloning.

In Solaris, if you want to create mirrored drives you would normally use two disks of the same geometry; ie, same model of disk.

If that's what you are trying to do then you would use a combination of the prtvtoc and fmthard commands to write the exact vtoc from the first disk to the second disk.

For example:

# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

Or you could write the vtoc to a file first and then use it as input to fmthard :

# prtvtoc /dev/rdsk/c0t0d0s2 > <vtocfile>
# fmthard -s <vtocfile> - /dev/rdsk/c0t1d0s2

(the S2 slice represents the whole drive)

This replicates the vtoc contents to the new disk for mirroring.

See the man pages for prtvtoc and fmthard :

# man prtvtoc
# man fmthard
2 Likes