Solved

reload partition table information

Posted on 2004-09-10
7
12,670 Views
Last Modified: 2010-05-18
Short :

How do I reload the partition table information w/o rebooting the system (VFAT) ?

Long:

I have deleted two (all) partitions from a second drive and then created one merged VFAT part. using FDISK, then used mkfs.vfat to format.
Now, how do I make linux (FC2 , kernel 2.6.x) to reload the partition information without rebooting the computer? Right now, when mounting /dev/hdb1 I find the old contents of the first partition I deleted, and that seems normal as that's the info it "remembers" .

thanks for any pointer

Kronos
0
Comment
Question by:kronostm
7 Comments
 
LVL 14

Author Comment

by:kronostm
ID: 12026402
I think the following is normal behavior though annoying:

(parted) check 1
Warning: Partition 1 is 76316.563Mb, but the file system is 20002.776Mb.
Ignore/Cancel? c
(parted)
0
 
LVL 20

Assisted Solution

by:Gns
Gns earned 50 total points
ID: 12027232
Hm, are we running into limitation of how big a vfat can raelly get here?

-- Glenn
0
 
LVL 23

Accepted Solution

by:
Mysidia earned 200 total points
ID: 12031927
I think the best thing to do is to reboot.

You could try making a call to the ioctl facility provided by the kernel re-read the partition table
(if the drivers/kernel correctly support the operation for that device, this may do the reload)

be careful and make sure no filesystem or other process is mounted on, accessing or
going to use anything on the device in the meantime (this snippet won't try to check)

/* Assume this source file is named reread.c and you use GCC as your
   C compiler...  commands:  

    Replace /dev/hdb below with the proper device
    gcc -o reread reread.c
   ./reread
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/fs.h>
#include <fcntl.h>

#define DEVICE_NODE "/dev/hdb"
                                                                               
int main()
{
   int fd;
                                                                               
   sync (); /* Sync disks */
                                                                               
   if ((fd = open(DEVICE_NODE, O_RDONLY)) < 0) { perror("open");
           close(fd); return 0; }
   if (ioctl(fd, BLKRRPART) < 0)
           perror("unable to reload table");
   close(fd);
                                                                               
}
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 2

Expert Comment

by:Sunjith
ID: 12039380
Linux fdisk usually calls the ioctl to reread the partition table when a new partition table is written to disk.
Are you sure that you wrote the new partition to disk after you modified the partition table in fdisk??
0
 
LVL 14

Author Comment

by:kronostm
ID: 12041622

Thanks guys.



Gns .... don't think so .... I've used even bigger than 80GB FAT's  in linux
Actually I have a movie storage drive (160GB) and I wanted to test what does Windows 2000 says about a 160GB FAT partition. Well, it reads with no prob. but doesn't write more than 128GB. However ... comin' back to our FAT ... I don't think it's too big to be read.

Mysidia .... that's very interesting. I will try it today and let you know the result.

Sunjith .... yes, I am sure. Look at this:

Command (m for help): p
                                                                               
Disk /dev/hdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
                                                                               
   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1        9729    78148161    c  W95 FAT32 (LBA)
0
 
LVL 14

Author Comment

by:kronostm
ID: 12041701
As expected .... my fault :((  .... forgot to issue a param for FAT32:
 mkfs.vfat /dev/hdb1 -F 32
.... notice the -F 32 .... w/o it  I had a Fat16 part ... now it's clear what happened.
Gns asked me if we're running into any limitations of how big a FAT can get .... well ... I'm sure neither him nor me were thinking about FAT16 ... but it was an idea though.
Mysidia came with  a good functioning C program.
Now everything is working fine. (BTW ... the partition table IS reread by system immediately after creating the file system so my question is somehow useless ... it was my fault as I forgot to create a FAT32 and got instead a default FAT16 partition.
0
 

Expert Comment

by:Jemshi
ID: 12278119
Best way to make fat filesystems on partitions is to do it from windows rather than from *nix.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux apache localhost dev laptop 5 48
mobaxterm not able to change directory 28 94
Auto channel for WiFi (Access Point) 3 76
expectj telnet failing 5 17
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now