This link will tell you.
I found myself needing to partition a LUN on one of the Windows servers I support, and was curious how to perform this operation from a shell prompt. After a bit of googling, I came across the diskpart utility. This nifty little utility allows you to view devices, create and destroy volumes, and modify partition tables. The syntax for the commands available to diskpart can be viewed by running the “help” subcommand:
C:\Bin> diskpart
DISKPART> help
Microsoft DiskPart version 5.1.3565
ADD - Add a mirror to a simple volume.
ACTIVE - Marks the current basic partition as an active boot partition.
ASSIGN - Assign a drive letter or mount point to the selected volume.
BREAK - Break a mirror set.
CLEAN - Clear the configuration information, or all information, off the
disk.
CONVERT - Converts between different disk formats.
CREATE - Create a volume or partition.
DELETE - Delete an object.
DETAIL - Provide details about an object.
EXIT - Exit DiskPart
EXTEND - Extend a volume.
HELP - Prints a list of commands.
IMPORT - Imports a disk group.
LIST - Prints out a list of objects.
INACTIVE - Marks the current basic partition as an inactive partition.
ONLINE - Online a disk that is currently marked as offline.
REM - Does nothing. Used to comment scripts.
REMOVE - Remove a drive letter or mount point assignment.
REPAIR - Repair a RAID-5 volume.
RESCAN - Rescan the computer looking for disks and volumes.
RETAIN - Place a retainer partition under a simple volume.
SELECT - Move the focus to an object.
To view the physical devices connected to a system, you can use the diskpart “list disk” subcommand:
C:\Bin> diskpart
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 28 GB 0 B
To view a device’s partition table, you can select a disk and run the “list partition” subcommand:
C:\Bin> diskpart
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 28 GB 32 KB
You can also list the volumes available to the system with the “list volume” subcommand:
C:\Bin> diskpart
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 D CD-ROM 0 B
Volume 1 C NTFS Partition 28 GB Healthy System
Windows has some awesome utilities buried in the Windows folder, and the new shell should make automating tasks on Windows platforms a TON easier. Shibby!
I will be attending USENIX next week in Boston, and am contemplating putting together a SysAdmin BOF. If you are planning to attend the conference and are interested in a systems BOF, drop me a line.
I wrote yesterday about the jmap utility, which is a great utility for better understanding the arrangement of the JVM’s heap. Each thread that lives inside the JVM also contains an execution stack, which is used to store local variables and state information to allow function calls to work. The Java SDK /JRE comes with the jstack utility, which can be used to print the stack of each thread in human readable form:
$ /usr/java/bin/jstack pgrep java
Attaching to process ID 16498, please wait...
Debugger attached successfully.
Client compiler detected.
JVM version is 1.5.0_06-b05
Thread t@25: (state = BLOCKED)
- java.lang.Thread.sleep(long) @bci=721371649 (Interpreted frame)
- java.lang.Thread.sleep(long) @bci=0 (Interpreted frame)
- com.sun.patchpro.model.PatchProStateMachine$17.synchronize(com.sun.patchpro.util.StateMachine) @bci=30, line=828 (Interpreted frame)
- com.sun.patchpro.util.State.run() @bci=45, line=261 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)
Thread t@23: (state = IN_NATIVE)
- java.lang.UNIXProcess.waitForProcessExit(int) @bci=0 (Interpreted frame)
- java.lang.UNIXProcess.waitForProcessExit(int) @bci=0 (Interpreted frame)
- java.lang.UNIXProcess.access$900(java.lang.UNIXProcess, int) @bci=2, line=17 (Interpreted frame)
- java.lang.UNIXProcess$2$1.run() @bci=17, line=86 (Interpreted frame)
Thread t@21: (state = BLOCKED)
- java.lang.Thread.sleep(long) @bci=144113 (Interpreted frame)
- java.lang.Thread.sleep(long) @bci=0 (Interpreted frame)
- com.sun.patchpro.plugins.sunos.pkg.SunOSBaseDataExtension.buildDatabase(java.io.InputStream) @bci=54, line=258 (Interpreted frame)
- com.sun.patchpro.plugins.sunos.pkg.SunOSBaseDataExtension.run() @bci=110, line=112 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)
Thread t@17: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=706035048 (Interpreted frame)
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- java.lang.Thread.join(long) @bci=70, line=1103 (Interpreted frame)
- com.sun.patchpro.analysis.SunOSBaseData$DetectorThread.join(int) @bci=6, line=310 (Interpreted frame)
- com.sun.patchpro.analysis.SunOSBaseData.run() @bci=310, line=132 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)
[ ..... ]
Each stack frame contains the state (e.g., runnable, blocked, etc) of the thread and a stack backtrace with the current stack frame displayed first. Good stuff!
The Solaris patchadd utility is well known for being able to apply a patch to a system, but few people know that it has a nifty “-p” (print installed patches) option to print the list of installed patches:
$ patchadd -p
Patch: 118996-02 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu SUNWhea
Patch: 118868-01 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu
Patch: 119687-01 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu
Patch: 119042-02 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu
Patch: 117461-04 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu SUNWcsl SUNWtoo SUNWcslr SUNWhea
[ ...... ]
I recon ‘showrev -p’ is used a bit more frequently, since this is what the official patch documentation uses to list installed patches. It’s the little things in life that make you the happiest. :)