Timeline for Why are partition size and df output different?
Current License: CC BY-SA 3.0
17 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 11, 2015 at 21:57 | history | edited | Faheem Mitha | CC BY-SA 3.0 | deleted 10 characters in body; edited title |
| Apr 14, 2011 at 12:48 | vote | accept | xralf | ||
| Apr 8, 2011 at 7:24 | comment | added | xralf | OK, I believe you, I don't have possibility to backup. It would be a long process and I would certainly forget to backup something, so I will give up the 20 GB of space and wait until I will reinstall the system. | |
| Apr 7, 2011 at 18:56 | comment | added | Faheem Mitha | @penguin: Thanks for the clarification. And yes, backups are good. :-) Oh, and I'm not the OP, in case you thought that. :-) | |
| Apr 7, 2011 at 18:53 | comment | added | penguin359 | @Faheem My last comment should answer your question. As for resizing, I'd be a bad sysadmin if I failed to remind you to backup, Backup, BACKUP! Aside from that, I have resized my Ext3 partitions many times on-line with a live production system and never had any issues. Just do resize2fs /dev/sda1 and watch the magic happen. | |
| Apr 7, 2011 at 18:51 | comment | added | penguin359 | A file system may reserve some space (4kB to 64kB) at the beginning for a bootloader. There may be space not accounted for in that equation used by filesystem structure like inode and super blocks. There is space reserved for root that does not show up in df, but doe show up in the block count * block size formula. The default for mke2fs is 5% reserved for root. That's where your .87 vs. .80 comes from. With that being said, on my 40GB Ext4 partition I get: (10488436*4096)/(41953747*1024) = .9999999284. I bet after you resize you have .99 and .94 for block count and df formulas | |
| Apr 7, 2011 at 18:36 | comment | added | Faheem Mitha | Ok, so some elementary arithmetic. 133808791552/ 153859653632 = 0.87 approx. However. 123/154=0.80 approx. Can anyone explain that discrepancy? Is it space reserved for root? | |
| Apr 7, 2011 at 18:11 | comment | added | Faheem Mitha | @xralf: resizing should be safe, I've never lost data doing it. It might be slightly safer to do it to an unmounted partition, with eg a live cd. But still, get yourself a backup first. Always get a backup before doing major sys admin stuff. | |
| Apr 7, 2011 at 12:12 | comment | added | xralf | @penguin359 I have ext4 filesystem. block count = 32668162, block size = 4096, 32668162 * 4096 = 133808791552, fdisk -s /dev/sda1 * 1024 = 153859653632. It seems to be oddly smaller. Can I resize it without loss of data? What caused that it is smaller? | |
| Apr 7, 2011 at 11:48 | comment | added | xralf | @Gilles sudo fdisk -l /dev/sda shows (I'm posting only the sda1 partition, because others don't interest us). Device Boot Start End Blocks Id System /dev/sda1 1 18706 150253568 83 Linux | |
| Apr 7, 2011 at 11:31 | answer | added | jlliagre | timeline score: 1 | |
| Apr 7, 2011 at 9:05 | answer | added | Mikel | timeline score: 6 | |
| Apr 7, 2011 at 7:33 | answer | added | balki | timeline score: 2 | |
| Apr 6, 2011 at 20:06 | comment | added | penguin359 | What filesystem are you using? If it's ext2/3/4 then you can use tune2fs -l /dev/sda1 to examine it. Look at block count and block size and multiply them to get the filesystem size. Also, fdisk -s /dev/sda1 to get the partition size in 1k-blocks. Multiply that by 1024 to get the size in bytes. That number should only be slightly larger than the filesystem. On my 40GB ext4 partition, it's 3072 bytes larger. If your filesystem is oddly smaller, you can try resizing it. For ext2/3/4, use resize2fs /dev/sda1. You can do this while using the computer normally. | |
| Apr 6, 2011 at 20:01 | comment | added | Gilles 'SO- stop being evil' | Please post the output of fdisk -l /dev/sda (run as root). | |
| Apr 6, 2011 at 19:46 | answer | added | Faheem Mitha | timeline score: 40 | |
| Apr 6, 2011 at 19:28 | history | asked | xralf | CC BY-SA 2.5 |