Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Getting Storage Device Sizes and Paths Post 302345856 by codecellar on Thursday 20th of August 2009 11:23:43 AM
Old 08-20-2009
Thanks. I feel like this may be solved soon. It does work for devices, but not the partitions on the device.

I have several partitions on sda that it did not return the size.

Also, is there a way to print actual bytes, this seams to be human readable form.

I'm going to have to study these commands a bit. I'll probably get it soon one way or another.

Thanks for putting me on the right track.
 

6 More Discussions You Might Find Interesting

1. Linux

Some problem about usb mass storage device

Dear linuxers, I have a usb mess storage device. My OS is rh as3 update2. Each time I use the command mount -t vfat /dev/sda1 /mnt/usb I got the error "the device is not a valid block device". I found from google that I should install the module sd_mod I use the command insmod sd_mod... (2 Replies)
Discussion started by: niukun
2 Replies

2. UNIX for Dummies Questions & Answers

path_to_inst output for usb storage device

Hello, I have a sun blade 100 with solaris 10 and am perplexed by the instances of devices that I see when I attach a usb flash stick to one of the ports in the back of the chassis. Here is what I see for USB storage in /etc/path_to_inst: "/pci@1f,0/usb@c,3/storage@3" 0 "scsa2usb"... (0 Replies)
Discussion started by: montana77
0 Replies

3. AIX

Storage paths

Have connected a non-IBM storage device to AIX host via fibre channel. If the storage is rebooted or a raid controller fails over whilst connected to the host, the paths that drop do not come back online when the ports become active again. I have tried enabling dynamic tracking and delayed_fail... (3 Replies)
Discussion started by: Storeman
3 Replies

4. Shell Programming and Scripting

crontab; copy most recent *.mpg file from local machine to smb storage device

Hello, I've been searching your forum for an answer to the following question and whilst I've seen several which may help I'm afraid my inexperience with UNIX systems has got the better of me and I'm incapable of piecing your considerable expertise together. Problem: I have a linux box which... (5 Replies)
Discussion started by: julezsht
5 Replies

5. Shell Programming and Scripting

Detecting A USB Storage Device From A Script

I need a way to reliably detect a USB storage device from a bash script. I know how to use 'lsusb' to list the USB devices - but then how can I match a device listed in 'lsusb' output to an actual disk device? Is there some way to map one to the other? Any help appreciated. (3 Replies)
Discussion started by: dmaddox099
3 Replies

6. Shell Programming and Scripting

File representing the hard disk storage device

I want example of a file representing the hard disk storage device In UNIX ? (6 Replies)
Discussion started by: tamer11007
6 Replies
PARTX(8)						       System Administration							  PARTX(8)

NAME
partx - tell the kernel about the presence and numbering of on-disk partitions SYNOPSIS
partx [-a|-d|-P|-r|-s|-u] [-t type] [-n M:N] [-] disk partx [-a|-d|-P|-r|-s|-u] [-t type] partition [disk] DESCRIPTION
Given a device or disk-image, partx tries to parse the partition table and list its contents. It can also tell the kernel to add or remove partitions from its bookkeeping. The disk argument is optional when a partition argument is provided. To force scanning a partition as if it were a whole disk (for example to list nested subpartitions), use the argument "-" (hyphen-minus). For example: partx --show - /dev/sda3 This will see sda3 as a whole-disk rather than as a partition. partx is not an fdisk program - adding and removing partitions does not change the disk, it just tells the kernel about the presence and numbering of on-disk partitions. OPTIONS
-a, --add Add the specified partitions, or read the disk and add all partitions. -b, --bytes Print the SIZE column in bytes rather than in human-readable format. -d, --delete Delete the specified partitions or all partitions. -g, --noheadings Do not print a header line with --show or --raw. -l, --list List the partitions. Note that all numbers are in 512-byte sectors. This output format is DEPRECATED in favour of --show. Do not use it in newly written scripts. -n, --nr M:N Specify the range of partitions. For backward compatibility also the format M-N is supported. The range may contain negative num- bers, for example --nr -1:-1 means the last partition, and --nr -2:-1 means the last two partitions. Supported range specifications are: M Specifies just one partition (e.g. --nr 3). M: Specifies the lower limit only (e.g. --nr 2:). :N Specifies the upper limit only (e.g. --nr :4). M:N Specifies the lower and upper limits (e.g. --nr 2:4). -o, --output list Define the output columns to use for --show, --pairs and --raw output. If no output arrangement is specified, then a default set is used. Use --help to get list of all supported columns. This option cannot be combined with the --add, --delete, --update or --list options. -P, --pairs List the partitions using the KEY="value" format. -r, --raw List the partitions using the raw output format. -s, --show List the partitions. The output columns can be selected and rearranged with the --output option. All numbers (except SIZE) are in 512-byte sectors. -t, --type type Specify the partition table type. --list-types List supported partition types and exit. -u, --update Update the specified partitions. -S, --sector-size size Overwrite default sector size. -v, --verbose Verbose mode. -V, --version Display version information and exit. -h, --help Display help text and exit. EXAMPLES
partx --show /dev/sdb3 partx --show --nr 3 /dev/sdb partx --show /dev/sdb3 /dev/sdb All three commands list partition 3 of /dev/sdb. partx --show - /dev/sdb3 Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk). partx -o START -g --nr 5 /dev/sdb Prints the start sector of partition 5 on /dev/sdb without header. partx -o SECTORS,SIZE /dev/sda5 /dev/sda Lists the length in sectors and human-readable size of partition 5 on /dev/sda. partx --add --nr 3:5 /dev/sdd Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd. partx -d --nr :-1 /dev/sdd Removes the last partition on /dev/sdd. SEE ALSO
addpart(8), delpart(8), fdisk(8), parted(8), partprobe(8) AUTHORS
Davidlohr Bueso <dave@gnu.org> Karel Zak <kzak@redhat.com> The original version was written by Andries E. Brouwer <aeb@cwi.nl>. ENVIRONMENT
LIBBLKID_DEBUG=all enables libblkid debug output. AVAILABILITY
The partx command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils /util-linux/>. util-linux December 2014 PARTX(8)
All times are GMT -4. The time now is 02:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy