Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I cannot find any detailed man info regarding the output of DVD+RW-MEDIAINFO DVD cmd. I want to convert the size info into GB using grep and bc. Here's what it generates when a blank DVD is inserted:
Code:
INQUIRY: [TSSTcorp][DVD+-RW TS-L632H][D400]
GET [CURRENT] CONFIGURATION:
Mounted Media: 1Bh, DVD+R
Current Write Speed: 8.0x1385=11080KB/s
Write Speed #0: 8.0x1385=11080KB/s
Write Speed #1: 6.0x1385=8310KB/s
Write Speed #2: 4.0x1385=5540KB/s
Write Speed #3: 3.0x1385=4155KB/s
Write Speed #4: 3.0x1385=4155KB/s
Write Speed #5: 3.0x1385=4155KB/s
Write Speed #6: 3.0x1385=4155KB/s
Write Speed #7: 3.0x1385=4155KB/s
Write Speed #8: 3.0x1385=4155KB/s
GET [CURRENT] PERFORMANCE:
Write Performance: 8.0x1385=11080KB/s@[0 -> 2295104]
Speed Descriptor#0: 00/2295103 R@8.0x1385=11080KB/s W@8.0x1385=11080KB/s
Speed Descriptor#1: 00/2295103 R@8.0x1385=11080KB/s W@6.0x1385=8310KB/s
Speed Descriptor#2: 00/2295103 R@8.0x1385=11080KB/s W@4.0x1385=5540KB/s
Speed Descriptor#3: 00/2295103 R@8.0x1385=11080KB/s W@3.0x1385=4155KB/s
READ DVD STRUCTURE[#0h]:
Media Book Type: 00h, DVD-ROM book [revision 0]
Media ID: SONY/D21
Legacy lead-out at: 2295104*2KB=4700372992
READ DISC INFORMATION:
Disc status: blank
Number of Sessions: 1
State of Last Session: empty
"Next" Track: 1
Number of Tracks: 1
READ TRACK INFORMATION[#1]:
Track State: blank
Track Start Address: 0*2KB
Next Writable Address: 0*2KB
Free Blocks: 2295104*2KB
Track Size: 2295104*2KB
READ CAPACITY: 0*2048=0
DVD+RW-MEDIAINFO DVD | GREP "Free Blocks:" returns Free Blocks: 2295104*2KB. Whats the best way to display it as 4GB. I know theres 1024MB in Gig. But whats with the *2KB. The documentation I found is too much to digest. Any suggestions or references?
Last edited by linuxman2013; 04-02-2013 at 01:59 PM.
The number of free blocks is 2295104 for this media (any single layer dvd actually....).
Each block can hold 2kBytes, so the disk capacity, in bytes, is 2295104*2kbytes, or almost 4,377 Gbytes.
The number of blocks is important because the disk can only allocate a integer number of blocks for a file. If you have a lot small files, lets say, files less than 2kbytes each, the disk can hold only 2,295,104 files that will not sum 4,377 Gbytes.....
The same is with your hard drive. Using 4k sectors on modern disks and using a file system that can not use the spare space at end of each sector, you could not fill the disk to its nominal capacity.
@marozsas I don't really understand the memory addressing scheme. From your reply it seems like a way for manufacturers to ensure that small files (less than 2k) will fit on a standard 4GB w/out scarificing space on the DVD. Is there a way to extract how much data is stored on a DVD? What if I decided to burn just 42mb to a DVD?
Last edited by linuxman2013; 04-04-2013 at 07:21 AM.
me neither !
I am not sure why is in that way. Some sort of optimization I guess....
I guess it has to do the mapping of used/free blocks on the media.
If your mapping scheme maps each byte on disk, your mapping is as big is the data. In this scheme (1:1) you will have only half of total space for data and the other half to mapping this data.
Using a 1:2048 mapping scheme you get a good balance between data and and the mapping for point to this data. But I am just guessing here...
If you write 42*2^20 bytes you will use 42*2^20 bytes/2*2^10 bytes/block = 21*2^10 blocks = 21,504 blocks from the 2,295,104 free blocks on the disk, which leaves 2,273,600 blocks of 2kbytes to write additional data (supposing media/drives/filesystems that support "open" disks).
That makes sense. I don't see how it can hold more than 4.3GB. When I execute the cmd on a DVD that I burned yrs ago, I get strange results. According to Nautilus the DVD holds 4.6GB, more than the 4.3GB cap. Here's the ouput:
Code:
INQUIRY: [TSSTcorp][DVD+-RW TS-L632H][D400]
GET [CURRENT] CONFIGURATION:
Mounted Media: 1Bh, DVD+R
Media ID: SONY/D21
Current Write Speed: 8.0x1385=11080KB/s
Write Speed #0: 8.0x1385=11080KB/s
Write Speed #1: 6.0x1385=8310KB/s
Write Speed #2: 4.0x1385=5540KB/s
Write Speed #3: 3.0x1385=4155KB/s
Write Speed #4: 3.0x1385=4155KB/s
Write Speed #5: 3.0x1385=4155KB/s
Write Speed #6: 3.0x1385=4155KB/s
Write Speed #7: 3.0x1385=4155KB/s
Write Speed #8: 3.0x1385=4155KB/s
GET [CURRENT] PERFORMANCE:
Write Performance: 8.0x1385=11080KB/s@[0 -> 2295104]
Speed Descriptor#0: 00/2295103 R@8.0x1385=11080KB/s W@8.0x1385=11080KB/s
Speed Descriptor#1: 00/2295103 R@8.0x1385=11080KB/s W@6.0x1385=8310KB/s
Speed Descriptor#2: 00/2295103 R@8.0x1385=11080KB/s W@4.0x1385=5540KB/s
Speed Descriptor#3: 00/2295103 R@8.0x1385=11080KB/s W@3.0x1385=4155KB/s
READ DVD STRUCTURE[#0h]:
Media Book Type: 00h, DVD-ROM book [revision 0]
Legacy lead-out at: 2242464*2KB=4592566272
READ DISC INFORMATION:
Disc status: complete
Number of Sessions: 1
State of Last Session: complete
Number of Tracks: 1
READ TRACK INFORMATION[#1]:
Track State: invisible
Track Start Address: 0*2KB
Free Blocks: 0*2KB
Track Size: 2242464*2KB
FABRICATED TOC:
Track#1 : 17@0
Track#AA : 17@2242464
Multi-session Info: #1@0
READ CAPACITY: 2242464*2048=4592566272
joe@name-comp-000:/dev$ dvd+rw-mediainfo dvd
INQUIRY: [TSSTcorp][DVD+-RW TS-L632H][D400]
GET [CURRENT] CONFIGURATION:
Mounted Media: 1Bh, DVD+R
Media ID: SONY/D21
Current Write Speed: 8.0x1385=11080KB/s
Write Speed #0: 8.0x1385=11080KB/s
Write Speed #1: 6.0x1385=8310KB/s
Write Speed #2: 4.0x1385=5540KB/s
Write Speed #3: 3.0x1385=4155KB/s
Write Speed #4: 3.0x1385=4155KB/s
Write Speed #5: 3.0x1385=4155KB/s
Write Speed #6: 3.0x1385=4155KB/s
Write Speed #7: 3.0x1385=4155KB/s
Write Speed #8: 3.0x1385=4155KB/s
GET [CURRENT] PERFORMANCE:
Write Performance: 8.0x1385=11080KB/s@[0 -> 2295104]
Speed Descriptor#0: 00/2295103 R@8.0x1385=11080KB/s W@8.0x1385=11080KB/s
Speed Descriptor#1: 00/2295103 R@8.0x1385=11080KB/s W@6.0x1385=8310KB/s
Speed Descriptor#2: 00/2295103 R@8.0x1385=11080KB/s W@4.0x1385=5540KB/s
Speed Descriptor#3: 00/2295103 R@8.0x1385=11080KB/s W@3.0x1385=4155KB/s
READ DVD STRUCTURE[#0h]:
Media Book Type: 00h, DVD-ROM book [revision 0]
Legacy lead-out at: 2242464*2KB=4592566272
READ DISC INFORMATION:
Disc status: complete
Number of Sessions: 1
State of Last Session: complete
Number of Tracks: 1
READ TRACK INFORMATION[#1]:
Track State: invisible
Track Start Address: 0*2KB
Free Blocks: 0*2KB
Track Size: 2242464*2KB
FABRICATED TOC:
Track#1 : 17@0
Track#AA : 17@2242464
Multi-session Info: #1@0
READ CAPACITY: 2242464*2048=4592566272
How can I extract the amount of used space on a DVD w/out writing a script? Is there another function in Bash?
Last edited by linuxman2013; 04-04-2013 at 08:10 AM.
I believe there is not a direct, specific function to return how much space is left in a disk.
You must use some kind of scripting to have this, but it is not complicated.
One possible approach could be something like this:
Code:
miguel@GMF23V1-x:~$ function freedvd {
dvd+rw-mediainfo $1 | grep "Free Blocks:" | rev | awk '{print $1}' | rev | sed 's/KB//' | bc
}
and use it like this:
Code:
miguel@GMF23V1-x:~$ freedvd /dev/sr0
4595776
to get the free space in kbytes, on a blank dvd on my machine.
Last edited by marozsas; 04-04-2013 at 02:54 PM.
Reason: Correcting: it returns the size in kilo bytes, not bytes as originally stated.
@marozsas neat script! dividing it twice by 1024 yields 4.3GB, what we originally determined to be the size of the DVD. My question now why it shows a max cap of 4.3 when there's actually more stored on the DVD. The DVD max cap according to Sony is actually 4.7GB, not the 4.3 we caculated from the output of dvd+rw-media info. So, it appears that its off by like .4GB. Any ideas?
Last edited by linuxman2013; 04-04-2013 at 02:29 PM.
I have an ideia...it is because what is known by overburning. Google about "dvd overburning" to learn more about it.
The media has some extra tracks that can be used write data past its nominal size, but this is not a guaranteed process.
PS: I make a correction in my previous post. You should read "to get the free space in kbytes" not just "bytes" as in the original sentence;
PS2: I'm glad you liked my little function. You can play/mess with the multipliers. For instance, to get the size in bytes, not in kbytes, change it to
Code:
dvd+rw-mediainfo $1 | grep "Free Blocks:" | rev | awk '{print $1}' | rev | sed 's/KB/*1024/' | bc
to get 4706074624, or to get the size in Gbytes, change it to :
Code:
dvd+rw-mediainfo $1 | grep "Free Blocks:" | rev | awk '{print $1}' | rev | sed 's#KB#/1024.0/1024.0#' | bc -l
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.